Home | Add to Favorites | Ebooks Directory | News  
SCJP Resources
Home
SCJP Article
SCJP 5.0
SCJP 1.2 Objectives
SCJP 1.4 Objectives
SCJP 5.0  Objectives
Free Simulator
Books
Free Questions
SCJP Faq
SCJP Mock exam
SCJP Dumps
SCJP Training
SCJP Sample questions

The following questions are sample questions for SCJP

If any queries regarding the questions or answers please mail us

 

51)

Which of the following methods are static members of the Thread class?


join

run

sleep

start

wait

Explanation:
No Explanation Available

Ans: 3


52)

class C {
public static void main(String[] args) {
  try
    {
        int i1=3/0;
      }
       System.out.println("hai");
    catch(NullpointerException e)
    {
        }
     finally
    {
              System.out.println("finally);
 
      }
}}


compile time errors

print hai and finally

the code compiles and runs fine

none of the above

Explanation:
No Explanation Available

Ans: 1

53)

class c1
{
public static void main(String a[])
{
    System.out.println(Double.NaN==Double.NaN);
    System.out.println(Double.NaN!=Double.NaN);
    System.out.println(Float.NaN==Double.NaN);
}
}


prints false true false

print true false true

prints true true true

prints false false false

compiletime error

Explanation:
No Explanation Available

Ans: 1

54)

class C {
  public static void main ( String ka [ ] ) {
          Thread t = Thread . currentThread ( ) ;
          t . setPriority ( - 1 ) ;
          System . out . println ( " Done ! " ) ;
  }
};


compile time error

Runtime Exception

The code compiles and runs fine

None of the above

Explanation:
No Explanation Available

Ans: 2

55)

class c1
{
   public void m1()
    {
       System.out.println("m1 method in C1 class");
     }
}
class c2
{
  public c1 m1()
   {
     return new c1(){
       public void m1()
          {
              System.out.println("m1 mehod in anonymous class");
    }};}
public static void main(String a[])
 {
               
 c1 ob1 =new c2().m1();
        ob1.m1();
}}


prints m1 method in C1 class

prints m1 method in anonumous class

compile time error

Runtime error

none of the above

Explanation:
the anonymous class overrides the m1 method in c1.so according to the dynamic dispatch the m1 method in the anonymous is called

Ans: 2

56)

class c1 extends Exception
{}
class c2
{
   static void m1()
    {
       throw new c1();
     }
  public static void main(String a[])
   {
          
    }
}


compile time error

Runtime Exception

The code compiles and runs fine

None of the above

Explanation:
No Explanation Available

Ans: 1

57)

class C {
static void m1(Object x) {System.out.print("Object");}
static void m1(String x) {System.out.print("String");}
public static void main(String[] args) {
m1(null);
}}


Prints Object

Prints String

compiletime error

None of the above

Explanation:
The more specific of the two, m(String x), is chosen

Ans: 2

58)

all classes of the java.lang package are automatically imported


true

false

Explanation:
No Explanation Available

Ans: 1

59)

The constructor for the Math class is private, so it cannot be instaniated


true

false

Explanation:
No Explanation Available

Ans: 1

60)

class C {
public static void main(String[] args) {
 int x=2;
 int y=3;
   if((y==x++)|(x<++y)){                     
         System.out.println(x+""+y);
        }
}}


prints  34

prints  33

compile time error

Runtime exception

None of the above

Explanation:
No Explanation Available

Ans: 1

                                                                                Go To Index