//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class H
{
public static void main(String args[])
{
H h1 = new H();
System.out.println("Hello World");
}
}
9. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class I
{
int x;
static void test()
{
I i1 = new I();
System.out.println(i1.x);
}
}
10. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class D
{
void test1();
{
System.out.println("From test1");
}
static void test2()
{
test1();
System.out.println("From test2");
}
}
11. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class K
{
int i ;
static
{
K k1 = new K();
System.out.println(k1.i);
}
}
12. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class L
{
void test1()
{
System.out.println("from test1");
}
static
{
L l1 = new L();
l1.test1();
}
}
13. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class M
{
int i;
static public void main(String[] args)
{
M m1 = new M();
System.out.println(m1.i);
m1.i = 10;
System.out.println(m1.i);
}
}
14. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class N
{
int i;
static public void main(String[] args)
{
N n1 = new N();
System.out.println(n1.i);
N n2 = new N();
System.out.println(n2.i);
n1.i = 10;
n2.i = 20;
System.out.println(n1.i);
System.out.println(n2.i);
}
}