Core Java - Interview Questions and Answers for 'Identifiers' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Core Java - Interview Questions and Answers for 'Identifiers' - 6 question(s) found - Order By Newest

 Q1. What is the difference between keywords, identifiers and literals in java ?Core Java
Ans. Keywords are the reserved words that have a pre defined meaning for the compiler and hence are restricted to be used as identifiers.

Identifiers are the name assigned to different programming constructs like classes, interfaces, methods , variables etc.

Literals are the values that are assigned to Identifiers.

For example

int count = 0;

in the above statement "int" is a keyword, "count" is an identifier and "0" is a literal

  Sample Code for keywords

  Sample Code for identifiers

  Sample Code for literals

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     keywords  literals  identifiers


 Q2. Is it a valid identifier in Java ?

int 123Abc = 5;
Core Java
Ans. No, identifier in java cannot start with a numeral.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     identifiers


 Q3. Is synchronized a keyword , modifier, identifier? what is it ?Core Java
Ans. synchronized is a keyword and a modifier. The synchronized keyword is used to indicate that a method can be accessed exclusively by one thread at a time.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     synchronization  synchronized  modifier  identifier     Asked in 2 Companies


 Q4. What is a difference between Identifier and keyword ?Core Java
Ans. Keyword is a reserved word that has a pre defined meaning for the compiler and hence cannot be used as an identifier, for example - final, private , for etc.

Identifier is the name given by the programmer to a programming construct, for example - class and method names etc.

java Keywords cannot be used as an identifier in java.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     identifier  keyword


 Q5. Can we use java keywords as identifiers ?Core Java
Ans. No, keyword has pre defined meaning for compiler and hence cannot be used as identifiers.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     keywords  identifier


 Q6. Can we use true and false as identifiers in java ? Are they keywords in Java ?Core Java
Ans. true and false are literals in java. No we cannot use them as identifiers.

  Sample Code for literal

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     identifiers  keywords  literals



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: