Java Certifications
www.javacertifications.com
 home  scjp1.5  scjp1.6  scwcd 1.5  scjp 1.5 questions  scjp 1.6 questions  scwcd 1.5 questions  scjp 1.5 success kit  scjp 1.6 success kit  
  JavaCertifications.net provides java certfication tutorials and mock questions.  


Bookmark and Share |||     Share   
805 scjp 1.6 questions with explanations ||| 788 scjp 1.5 questions with explanations ||| 650 SCWCD 5.0 questions with explanations

Mock Questions

  scjp 1.5

  • Declarations, Initialization & Scoping
  • Method overriding or overloading
  • Inner Classes
  • Flow Control
  • Type Safe Enum
  • Enhanced for loop
  • Assertions
  • Exception
  • API Contents autoboxing & unboxing
  • File
  • Serializable
  • java.text and Locale
  • Regular Expression
  • Collections and Generics
  • Thread and Concurrency

  •   scjp 1.6

  • Declarations, Initialization & Scoping
  • Method overriding or overloading
  • Inner Classes
  • Flow Control
  • Type Safe Enum
  • Enhanced for loop
  • Assertions
  • Exception
  • API Contents autoboxing & unboxing
  • File
  • Serializable
  • java.text and Locale
  • Regular Expression
  • Collections and Generics
  • Thread and Concurrency
  • NavigableMap
  • NavigableSet
  • java.io.Console

  •   scwcd 1.5

  • Servlet Basic
  • The Structure and Deployment of Web Applications
  • The Web Container Model
  • Servlet event listeners
  • Session Management,session listeners
  • Servlet Filter
  • Web Application Security
  • j2ee patterns
  • JSP Directives
  • JSP page life cycle
  • JSP implicit objects
  • JSP include
  • Expression Language (EL)
  • JSTL
  • Building a Custom Tag Library
  • SCJP : Method overriding or overloading Mock Exam Practice Questions

    Questions no -1 
    What is the output for the below code ?
    
    public class B {
    	
    	public String getCountryName(){
    		return "USA";
    	}
    	
    	public StringBuffer getCountryName(){
    		StringBuffer sb = new StringBuffer();
    		sb.append("UK");
    		return sb;
    	}
    	
    	
    	public static void main(String[] args){
    		B b = new B();
    		System.out.println(b.getCountryName().toString());
    	}
    
    }
    
    
    options A)Compile with error B)USA C)UK D) Runtime Exception Correct answer is : A Explanations : You cannot have two methods in the same class with signatures that only differ by return type.
    Questions no -2 
    What is the output for the below code ?
    
    public class C {
    
    }
    
    public class D extends C{
    
    }
    
    public class A {
    	
    	public C getOBJ(){
    		System.out.println("class A - return C");
    		return new C();
    		
    	}
    
    }
    
    public class B extends A{
    	
    	public D getOBJ(){
    		System.out.println("class B - return D");
    		return new D();
    		
    	}
    
    }
    
    public class Test {
    
    public static void main(String... args) {
         A a = new B();
         a.getOBJ();
    	
         }
    }
    
    
    options A)Compile with error - Not allowed to override the return type of a method with a subtype of the original type. B)class A - return C C)class B - return D D) Runtime Exception Correct answer is : C Explanations : From J2SE 5.0 onwards. You are now allowed to override the return type of a method with a subtype of the original type.
    Questions no -3 
    What is the output for the below code ?
    
    public class A {
    	
    	public String getName() throws ArrayIndexOutOfBoundsException{
    		return "Name-A";
    	}
    	
    }
    	
    public class C extends A{
    	
    	public String getName() throws Exception{
    		return "Name-C";
    	}
    
    }
    	
    	
    public class Test {
    	public static void main(String... args) {
    		A a = new C();
    		a.getName();
    	}
    	
    }
    
    
    options A)Compile with error B)Name-A C)Name-C D)Runtime Exception Correct answer is : A Explanations : Exception Exception is not compatible with throws clause in A.getName(). Overridden method should throw only same or sub class of the exception thrown by super class method.
    scjp 1.5 | scjp 1.6 | scwcd 1.5
    Java Certifications
    www.javacertifications.net