![]() The concept of a singleton class is used for the situations while there is a requirement to limit the no of objects for a class. In Java, a singleton class can have only one instance and thus all its variables and methods belong to one instance. What is a singleton class? Give an example Thus in do while loop case, statements are implemented at least once.Ħ. The condition is tested first before implementation of statements in while loops.ĭo while loop is similar to while loop with an only difference which condition is examined after implementation of statement blocks. While loop is used if certain statements require being implemented regularly until a condition is satisfied. For loops are used when no of times to implement the statements is refer to the programmer. There are three types of loops in Java:įor loops are used in java to implement statements regularly for a given no of times. Looping is used in programming to implement a statement or a statement block repeatedly. This is a Java Basic Interview Questions to know mandatorily before attending any interviews. What is called Loops in Java? What are the three types of loops? ![]() To make a variable or method shared for all objects, we use.ĥ. When there is a need to share a variable or a method between multiple objects of a class rather than creating separate copies for each object. What is the purpose of static variables and static methods? Encapsulation is also used for data hiding purpose.Ĥ. Encapsulation helps the programmers in following a modular approach for the software development as each object has its unique set of variables and methods and serves its functions independent of other objects. What is known as data encapsulation and explain it’s significance?Įncapsulation is the concept which is asked frequently in the most Core Java Interview Questions for Freshers.Įncapsulation is said to be a concept in Object Oriented Programming for combining methods and properties in a single unit. Sub-class can access all protected and public fields and methods of its superclass.ģ. An inner class has access rights for the class that is nesting it and can access all methods and variables that are defined in the outer class.Ī subclass inherits from the other class known as the superclass. It is a Core Java Interview Questions, when you are a beginner go through the answer carefully.Īn inner class has been nested within the other class. What is the difference between an Inner class and a Subclass?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |