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

DECLARATION AND ACCESS CONTROL

Declaration and Access Control
Determine Output:class MyClass{ static final int a = 20; static final void call(){ System.out.println("two"); } static{ System.out.println("one"); }}public class Test{ public static void main(String args[]){ System.out.println(MyClass.a); }}

one two
one two 20
20
one 20
one

ANSWER DOWNLOAD EXAMIANS APP

Declaration and Access Control
What is the output for the below code ?public class A{ static{ System.out.println("static"); } { System.out.println("block"); } public A(){ System.out.println("A"); } public static void main(String[] args){ A a = new A(); }}

static A
None of these
static block A
A block static
A

ANSWER DOWNLOAD EXAMIANS APP

Declaration and Access Control
What will be the output?public class Test{ public static void main(String[] args){ String value = "abc"; changeValue(value); System.out.println(value); } public static void changeValue(String a){ a = "xyz"; }}

abc
None of these
Compilation clean but no output
xyz
Compilation fails

ANSWER DOWNLOAD EXAMIANS APP

Declaration and Access Control
Name the keyword that makes a variable belong to a class, rather than being defined for each instance of the class.

native
final
static
abstract
volatile

ANSWER DOWNLOAD EXAMIANS APP

Declaration and Access Control
What will be the output for the below code?public class Test{ static{ int a = 5; } public static void main(String[] args){ System.out.println(a); }}

None of these
Runtime Exception
0
Compile with error
5

ANSWER DOWNLOAD EXAMIANS APP
  • «
  • 1
  • 2
  • 3
  • 4
  • 5
  • »

GO TO PAGE

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
↑