• 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
Name the keyword that makes a variable belong to a class, rather than being defined for each instance of the class.

native
final
volatile
static
abstract

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(); }}

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

ANSWER DOWNLOAD EXAMIANS APP

Declaration and Access Control
What is the result of compiling and running the following code?class Base{ private Base(){ System.out.print("Base"); }}public class test extends Base{ public test(){ System.out.print("Derived"); } public static void main(String[] args){ new test(); }}

Compilation Error
BaseDerived
Derived
Exception is thrown at runtime

ANSWER DOWNLOAD EXAMIANS APP

Declaration and Access Control
A package is a collection of

Editing tools and Interfaces
Classes
Interfaces
Classes and Interfaces
Editing tools

ANSWER DOWNLOAD EXAMIANS APP

Declaration and Access Control
What will be the output after compiling and running following program code?public class Test{ static int a; public static void main(String[] args){ System.out.println("one"); call(1); } static void call(int a){ this.a=10; System.out.println("two "+a); }}

one two 0
None of these
one two 1
one two 10
Compile time error.

ANSWER DOWNLOAD EXAMIANS APP

Declaration and Access Control
The object is created with new keyword

At Compile-time
None of these
Depends on the code
At run-time

ANSWER DOWNLOAD EXAMIANS APP
MORE MCQ ON Declaration and Access Control

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
↑