//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
package pack1;
class J
{
private int x;
int y;
}
class K extends J
{
public static void main(String[] args)
{
K k1 = new K();
System.out.println(k1.x);
System.out.println(k1.y);
}
}
7. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
package pack1;
class L
{
private void test1()
{
System.out.println("from test1");
}
void test2()
{
System.out.println("from test2");
}
}
class M extends L
{
public static void main(String[] args)
{
M m1 = new M();
m1.test1();
m1.test2();
System.out.println("done");
}
}
8. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
package pack1;
class N
{
private N()
{
System.out.println("N()");
}
public static void main(String[] args)
{
N n1 = new N();
System.out.println("done");
}
}
9. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
package pack1;
class O
{
private O()
{
System.out.println("O()");
}
}
class P
{
public static void main(String[] args)
{
O o1 = new O();
System.out.println("done");
}
}
10. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
package pack1;
class Q
{
private Q()
{
System.out.println("Q()");
}
}
class R extends Q
{
public static void main(String[] args)
{
System.out.println("done");
}
}