Skip to main content

RESERVED WORDS

RESERVED WORDS:

In java some identifiers are reserved to associate some functionality or meaning such type of reserved identifiers are called reserved words.
Diagram:




Reserved words for data types: (8) 


  1. byte 
  2. short 
  3. int 
  4. long 
  5. float  
  6. double 
  7. char 
  8. boolean

Reserved words for flow control:(11)

  1. if  
  2. else 
  3. switch  
  4. case
  5. default 
  6. for
  7. do 
  8. while 
  9. break 
  10. continue  
  11. return 

Keywords for modifiers:(11)

  1. public 
  2. private 
  3. protected 
  4. static 
  5. final
  6. abstract
  7. synchronized
  8. native  
  9. strictfp(1.2 version) 
  10. transient
  11. volatile

Keywords for exception handling:(6)

  1. try 
  2. catch 
  3. finally 
  4. throw 
  5. throws 
  6. assert(1.4 version)

Class related keywords:(6)

  1. class 
  2. package 
  3. import 
  4. extends 
  5. implements 
  6. interface 

Object related keywords:(4)

  1. new
  2. instanceof 
  3. super 
  4. this

Void return type keyword:

If a method won't return anything compulsory that method should be declared with the void return type in java but it is optional in C++. 
  1.  void

Unused keywords:

goto:Create several problems in old languages and hence it is banned in java.

Const:Use final instead of this. 

By mistake if we are using these keywords in our program we will get compile time error.

Reserved literals:  

  1. true---------values for boolean data type.
  2. false---------values for boolean data type.
  3. null-------- default value for object reference.

Enum:

This keyword introduced in 1.5v to define a group of named constants.
 Example: 
enum sports
{
 bat, ball, stump;
 } 

Conclusions :

  1. All reserved words in java contain only lowercase alphabet symbols.
  2. New keywords in java are: 
  • strictfp-----------1.2v 
  • assert-------------1.4v 
  • enum--------------1.5v 
  1. In java we have only new keyword but not delete because destruction of useless objects is the responsibility of Garbage Collection.
  • instanceof but not instanceOf
  • strictfp but not strictFp 
  • const but not Constant 
  • syncronized but not syncronize
  • extends but not extend 
  • implements but not implement 
  • import but not imports 
  • int but not Int

Which of the following list contains only java reserved words ?

  1. final, finally, finalize (invalid) //here finalize is a method in Object class. 
  2. throw, throws, thrown(invalid) //thrown is not available in java 
  3. break, continue, return, exit(invalid) //exit is not reserved keyword
  4. goto, constant(invalid) //here constant is not reserved keyword 
  5. byte, short, Integer, long(invalid) //here Integer is a wrapper class 
  6. extends, implements, imports(invalid) //imports keyword is not available in java 
  7. finalize, synchronized(invalid) //finalize is a method in Object class 
  8. instanceof, sizeOf(invalid) //sizeOf is not reserved keyword 
  9. new, delete(invalid) //delete is not a keyword

NEXT TOPIC:DATA TYPES

Comments

Popular posts from this blog

Industry Ethics and Legal Issues MCQ Questions With Answer

ETHICS ALL POSSIBLE QUESTION - SET 1 Q1. Before 16 Jan, How many states were already working in Startup India policies? a) 1 b) 3 c) 4 d) 7 Q2. Which of the following is not a part of Funding Innovation? a) Incubation Center b) Startup Yatra Funds c) Research Parks d) Manak Q3. For R& D, human resource started a new scheme for students a) Tinkering labs b) Manak c) Avishkar yojana d) Uchhatar Avishkar yojana Q4. Startup India Scheme? 1. Age should not be more than 3 years 2. Should develop innovative product. 3. Must be Private Limited Company/ Registered Partnership firm/ Limited Liability Partnership 4. Has patent granted in areas affiliated with the nature of business being promoted a) 1, 3 6) 1,2 and3 c) 2, 3 and 4 d) All of the above Q5. The period of business when an entrepreneur must position the venture in a market and make necessary adjustments to assure survival is called the: a) pre-Startup stage b) Startup singe

SET 2

ETHIC MCQ- SET 2 Q101. SISHU stage of MUDRA loan scheme provides maximum amount of? a) RS 10 Thousand b) RS 20 Thousand c) RS 30 Thousand d) RS 50 Thousand Q102. A criminal activity within the information technology infrastructure. a) Digital crime b) Intellectual property c) Cyber-crime d) All of them Q103. Law is the system of rules of conduct established by the government of a society to maintain a) Justice b) Consistency c) None of these d) Both A & B Q104. ln which year Pradhan Mantri MUDRA Yojana was launched? a) 2015 b) 2016 c) 2014 d) 2013 Q105. Minimum how many numbers of directors required in Public company a) 9 b) 8 c) 3 d) 10 Q106. Which of the following is not considered while selecting the region? a) Law and order b) Price of land c) Availability of raw materials d) Proximity to the product market Q107. A genetic term that is concerned to the legal and regulatory aspects of Internet and computer technolo

DIGITAL MARKETING

DIGITAL MARKETING END TERM PRACTICAL PAPERS: