Java - Online Test - Variable - javasearch.buggybread.com


Share

Search Java Test Questions


 223 test questions in repository.




Java - Test Questions on 'Variable' - 8 questions found


Variables of an interface are intrinsically ... Core Java
transient
final
public
static

  java  interface  interface variables

Which of the following is wrong for final instance variables ?Core Java
They cannot be changed after initialization
They can be initialized directly within static method
They can be declared and initialized together at the same place
They can be initialized within constructor

  java  final  final variable  java keywords

What is an instance variable?Core Java
An instance or object of an class
The field of an object
Any variable of a class
None of the above

  java  oops  oop  instance variable  variables

Which of the following can be marked static ?Core Java
Methods , Variables and Initialization Blocks.
Methods , Variables , Initialization Blocks and Outer Classes and nested Classes.
Methods , Variables , Initialization Blocks and Outer Classes.
Methods , Variables , Initialization Blocks and nested Classes.

  oops  java  static  nested classes  static nested classes

Which of the following is true ?Core Java
We can serialize static variables
We can serialize transient variables
We can serialize final variables
We can serialize instance methods

  serialization  java  file io

What will be the output upon executing following class ?

public class BuggyBread {

static {
System.out.println("Static Block");
}

{
System.out.println("Instance Initialization Block");
}

BuggyBread(){
System.out.println("Constructor");
}

public static void main(String[] args){
System.out.println("Main Method");
new BuggyBread();
}
}
Core Java
Instance Initialization Block
Constructor
Static Block
Main Method
Static Block
Instance Initialization Block
Constructor
Main Method
Main Method
Static Block
Instance Initialization Block
Constructor
Static Block
Main Method
Instance Initialization Block
Constructor

  static block  Instance Initialization Block

What will be the output of executing following class ?

public class BuggyBread {

static {
System.out.println("Static Block");
}

{
System.out.println("Initialization Block");
}

BuggyBread(){
System.out.println("Constructor");
}

public static void main(String[] args){
System.out.println("Main Method");
}
}
Core Java
Static Block
Main Method
Static Block
Instance Initialization Block
Main Method
Static Block
Constructor
Main Method
Static Block
Instance Initialization Block
Constructor
Main Method

  static block  Instance Initialization Block

Which of following are serialized ?Core Java
static variables
transient variables
instance variables
method local variables

  serialization







comments powered by Disqus