Java Basic Program Practice Test-8

What will be the output of the following java code?

class Hello {

String str = "Java";

Hello() {

System.out.println("Spring");

}

}

public class Test {

public static void main(String[] args) {

System.out.println(new Test().getClass().getSuperclass());

}

}

What will be the output of the following java code?

class Hello {

public static void check() {

System.out.println("welcome");

}

}

public class Test extends Hello {

public static void check() {

System.out.println("Good");

}

public static void main(String[] args) {

Hello h = new Test();

h.check();

}

}

What will be the output of the following java code?

public abstract class Test {

private void check() {
System.out.println("welcome");

}

public static void main(String[] args) {

Test t=new Test();

t.check();
System.out.println("Abstract");

}

}

What will be the output of the following java code?

class Hello {

static final int i = 25;

static {

System.out.print("welcome ");

}}

public class Test {

int i = 50;

static {

System.out.print("java ");

}

public static void main(String[] args) {

System.out.print(Hello.i);

}

}

What will be the output of the following java code?

public class Test {

public static void main(String[] args) {

boolean assert=true;

if(assert){

System.out.println("welcome");

}

}

}