Is the Java code written correctly?
package pack1;
class A
{
}
package pack2;
class B extends A
{
}
Which of these is a mechanism for naming and visibility control of a class and its members?
The type of variable ‘y’ and ‘v’ in the declaration below is?
int x[], y;
int []u, v;
Predict the output of the following Java code.
import java.util.*;
class Abekus {
public static void main(String args[]) {
Formatter F = new Formatter();
F.format("%X", 230);
System.out.println(F);
}
}
Which of the following statements about packages is incorrect?
Predict the output of the following Java code:
class Abekus {
public static void main(String args[])
{
String abe1 = "I am intern at Abekus";
String abe2 = new String(abe1);
System.out.println((abe1 == abe2) + " " + abe1.equals(abe2));
}
}
public void test(int x)
{
int odd = 1;
if(odd) /* Line 4 */
{
System.out.println("odd");
}
else
{
System.out.println("even");
}
}
Which statement is true?
class check
{
int side,result;
void Area(int side)
{
result = side*side;
}
}
public class output{
public static void main(String args[])
{
check obj = new check();
obj.Area(263);
System.out.println(obj.result);
}
}
Predict the output of the following Java code:
class Abekus {
public static void main(String args[])
{
String str = "Java Programming";
String str1 = "Java";
if (str.startsWith("J"))
System.out.println("Start Same");
if (str.endsWith("T"))
System.out.println("End Same");
}
}
What is the output of the following program?
public class Test implements Runnable
{
public void run()
{
System.out.printf(" Thread's running ");
}
try
{
public Test()
{
Thread.sleep(5000);
}
}
catch (InterruptedException e)
{
e.printStackTrace();
}
public static void main(String[] args)
{
Test obj = new Test();
Thread thread = new Thread(obj);
thread.start();
System.out.printf(" Abekus");
}
}