• HOME
  • QUIZ
  • CONTACT US
EXAMIANS
  • COMPUTER
  • CURRENT AFFAIRS
  • ENGINEERING
    • Chemical Engineering
    • Civil Engineering
    • Computer Engineering
    • Electrical Engineering
    • Mechanical Engineering
  • ENGLISH GRAMMAR
  • GK
  • GUJARATI MCQ

JAVA Constructors and Methods

JAVA Constructors and Methods
The variables declared in a class for the use of all methods of the class are called

objects
reference variables
instance variables
None of these

ANSWER DOWNLOAD EXAMIANS APP

JAVA Constructors and Methods
The finalize() method is called just prior to

An object or variable goes out of scope.
An object, variable or method goes out of scope.
A variable goes out of scope.
None of these
Before garbage collection.

ANSWER DOWNLOAD EXAMIANS APP

JAVA Constructors and Methods
What is the output of the program?class Test{ public int display(int x, int y){ return ("The sum of x and y is " + x + y); } public static void main(String args[]){ Test test = new Test(); System.out.println(test.display(4,5)); } }

The sum of x and y is 45
The sum of x and y is 9
None of these
does not compile

ANSWER DOWNLOAD EXAMIANS APP

JAVA Constructors and Methods
public class Test { }What is the prototype of the default constructor?

public Test( )
public Test(void)
Test(void)
None of these
Test( )

ANSWER DOWNLOAD EXAMIANS APP

JAVA Constructors and Methods
public class MyClass{ }For the above class(MyClass) what is the correct way of declaring constructor?

public MyClass(void){}
1 and 3
public MyClass(){}
MyClass(){}
MyClass(void) {}

ANSWER DOWNLOAD EXAMIANS APP

JAVA Constructors and Methods
What will be the result of compiling and running the given code?class A{ int b=10; private A(){ this.b=7; } int f(){ return b; }}class B extends A{ int b;}public class Test{ public static void main(String[] args){ A a = new B(); System.out.println(a.f()); }}

Prints 7
Prints 10
Compilation Fails
None of these
Prints 0

ANSWER DOWNLOAD EXAMIANS APP
MORE MCQ ON JAVA Constructors and Methods

DOWNLOAD APP

  • APPLE
    from app store
  • ANDROID
    from play store

SEARCH

LOGIN HERE


  • GOOGLE

FIND US

  • 1.70K
    FOLLOW US
  • EXAMIANSSTUDY FOR YOUR DREAMS.
  • SUPPORT :SUPPORT EMAIL ACCOUNT : examians@yahoo.com

OTHER WEBSITES

  • GUJARATI MCQ
  • ACCOUNTIANS

QUICK LINKS

  • HOME
  • QUIZ
  • PRIVACY POLICY
  • DISCLAIMER
  • TERMS & CONDITIONS
  • CONTACT US
↑