-
Academic Resource
Aptitude Data Interpretation Verbal Reasoning Non Verbal Reasoning Verbal Ability Programming General Knowledge Puzzle
-
Engineering
Computer Engineering Electronics and Communication Electrical Engineering Mechanical Engineering Civil Engineering Biotechnology Architecture & Planning
-
Online Test
Aptitude Test Data Interpretation Test Verbal Reasoning Test Non Verbal Reasoning Test Verbal Ability Test
- Exams
-
More
Full Forms हिंदी
Home » JAVA Programming » Modifier Types » Question
Modifier Types
Easy Questions
JAVA Programming
Java Basic
Basic Syntax
Object & Classes
Basic Datatypes
Variable Types
Modifier Types
Basic Operators
Loop Control
Decision Making
Numbers
Characters
Strings
Arrays
Date & Time
Regular Expressions
Methods
Files and I/O
Exceptions
Inheritance
Polymorphism
Abstraction
Encapsulation
Interfaces
Packages
Data Structures
Collections
Generics
Serialization
Networking
Multithreading
Applet
Which of these is used to access member of class before object of that class is created?
- public
- static
- protected
- private
- None of these
Correct Option: B
static
Your comments will be displayed only after manual approval.
2. Which of these is used to access member of class before object of that class is created?a) publicb) privatec) staticd) protectedAnswer: cExplanation: None.View Answer
3. Which of these is used as default for a member of a class if no access specifier is used for it?View Answer
4. What is the process by which we can control what parts of a program can access the members of aclass?View Answer
Explanation: None.5. Which of the following statements are incorrect?View Answer
6. What is the output of this program?1.classaccess2.3.publicintx4.privateinty5.voidcal(inta,intb6.7.x=a+8.y={;;){1;b;
9.}10.}11.classaccess_specifier12.{13.publicstaticvoidmain(Stringargs[])14.{15.access obj=newaccess();16.obj.cal(2,3);17.System.out.println(obj.x+" "+obj.y);18.}19.}a) 3 3b) 2 3c) Runtime Errord) Compilation ErrorView AnswerAnswer: cExplanation: None.output:$ javac access_specifier.javaException in thread “main” java.lang.Error: Unresolved compilation problem:The field access.y is not visible
7. What is the output of this program?{;;)
6.{7.x=a+1;8.y=b;9.}10.voidprint()11.{12.system.out.println(" "+y);13.}14.}15.classaccess_specifier16.{17.publicstaticvoidmain(Stringargs[])18.{
19.access obj=newaccess()20.obj.cal(2,3)21.System.out.println(obj.x)22.obj.print()23.24.;;;;}}View Answer
8. What is the output of this program?{;;)
6.{7.x=a+b;8.y=x+b;9.}10.}11.classstatic_use12.{13.publicstaticvoidmain(Stringargs[])14.{15.static_out obj1=newstatic_out();16.static_out obj2=newstatic_out();17.inta=2;18.obj1.add(a, a+1);19.obj2.add(5, a);20.System.out.println(obj1.x+" "+obj2.y);21.}22.}
a) 7 7b) 6 6c) 7 9d) 9 7View Answer