Core java interview Questions You'll Most Likely Be Asked (Second Edition)


• • • • • • • • • • 014


Download 1.52 Mb.
Pdf ko'rish
bet10/171
Sana07.01.2023
Hajmi1.52 Mb.
#1081886
1   ...   6   7   8   9   10   11   12   13   ...   171
Bog'liq
Core JAVA Interview Questions Youll M...

013.










014.
a.
private, protected access specifiers. Note that a high–level
class cannot have these specifiers. This can only be used for an
inner class. Approach e uses the static keyword. Again, only an
inner class can have this access specifier.
How will you define an Identifier?
Answer:
Identifier is the name given to a class, method, variable or
interface. There are several rules for Java identifiers. These are
as follows:
Identifiers must start with an alphabet, the dollar sign ($), or
an underscore character (_)
Identifiers can contain alphabets, digits, $ and _
Identifiers cannot contain special characters
Identifiers are case sensitive
Some of the examples of legal identifiers are shown below:
b
$a
book
author1
myName
___1_c
What are the modifiers that cannot be specified with an
instance variable?
Answer:
The following modifiers cannot be specified with an instance
variable:
abstract: is valid only for classes, interfaces and methods, it
cannot be specified with an instance variable


b.
c.
d.
015.
a.
b.
c.
d.
e.
f.
g.
h.
016.
synchronized
native
The keywords synchronized and native are valid only for methods
and cannot be specified with an instance variable.
void: can only be specified as a return type, when a method
does not return any value
What are the modifiers that can be specified with a
method declaration?
Answer:
The following keywords can be specified with a method
declaration:

Download 1.52 Mb.

Do'stlaringiz bilan baham:
1   ...   6   7   8   9   10   11   12   13   ...   171




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling