java

Java minus sign

Multiple choice question

What will be the output of the following code part:

 Integer i = 34;
String s = "is my age";
String out = i + '-' + s;
System.out.println(out);

Basic Java Quiz

Questions:3
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Backwards navigation:Allowed

Take a basic Java quiz. Test your knowledge in Java.

Start quiz

In Java, can Enum extends another Enum?

Multiple choice question

In Java, can Enum extends another Enum, so the new Enum will add more elements to another Enum?

Java getClass getSimpleName

Multiple choice question

Given the following, what will be the output?

public class TestA {
public TestA(){ }
public void test(){
String s = getClass().getSimpleName();
System.out.print(s);
}
}

public class TestB extends TestA{
public TestB(){ }
static public void main(String[] args){
TestA a = new TestA();
TestB b = new TestB();
a.test();
b.test();
}
}

Syndicate content