Raj
Originally posted by bala_chocos:
hi
anyone can help me . below is sun sample questions.please give the correct answer
1. What would be the result of attempting to compile and run the following piece of code?
public class Test {
static int x; public static void main
(String args[ ])
{System.out.println("Value is " + x);}
}
The output "Value is 0" is printed.
An object of type NullPointerException is thrown.
An "illegal array declaration syntax" compiler error occurs.
A "possible reference before assignment" compiler error occurs.
An object of type ArrayIndexOutOfBoundsException is thrown.
2. What should you use to position a Button within an application Frame so that the size of the Button is NOT affected by the Frame size?
a FlowLayout
a GridLayout
the center area of a BorderLayout
the East or West area of a BorderLayout
the North or South area of a BorderLayout
3. Which is the advantage of encapsulation?
Only public methods are needed.
No exceptions need to be thrown from any method.
Making the class final causes no consequential changes to other code.
It changes the implementation without changing the interface and causes no consequential changes to other code.
It changes the interface without changing the implementation and causes no consequential changes to other code.
4. Which of the following most directly supports retrieval of stored objects based on a unique key of String type?
Map
Set
List
Collection
Enumeration
5. Which statement is true about a non-static inner class?
It must implement an interface.
It is accessible from any other class.
It can only be instantiated in the enclosing class.
It must be final if it is declared in a method scope.
It can access private instance variables in the enclosing object.
6. Which are keywords in Java (select all that apply)?
NULL
sizeof
friend
extends
synchronized
7. Which declares an abstract method in an abstract Java class?
public abstract method();
public abstract void method();
public void abstract Method();
public void method() {abstract;/}
public abstract void method() {/}
1 a
2 a
3 e
4 c
5 c,e
6 d,e
7 b,c
The above mentioned answers are correct or not.if it is wrong
give me the correct answer ans explanation
What's gotten into you? Could it be this tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|