- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Maruthi Krishna has Published 951 Articles
Maruthi Krishna
297 Views
A constant variable is the one whose value is fixed and only one copy of it exists in the program. Once you declare a constant variable and assign value to it, you cannot change its value again throughout the program.Unlike other languages java does not support constants directly. But, you ... Read More
Maruthi Krishna
560 Views
If you declare a variable static and final you need to initialize it either at declaration or, in the static block. If you try to initialize it in the constructor, the compiler assumes that you are trying to reassign value to it and generates a compile time error −Example Live Democlass ... Read More
Maruthi Krishna
1K+ Views
A final variable which is left without initialization is known as blank final variable.Generally, we initialize instance variables in the constructor. If we miss out they will be initialized by the constructors by default values. But, the final blank variables will not be initialized with default values. So if you ... Read More
Maruthi Krishna
3K+ Views
Whenever you make a method final, you cannot override it. i.e. you cannot provide implementation to the superclass's final method from the subclass.i.e. The purpose of making a method final is to prevent modification of a method from outside (child class).In inheritance whenever you extend a class. The child class ... Read More
Maruthi Krishna
612 Views
When you try to hold the super class’s reference variable with a sub class object, using this object you can access the members of the super class only, if you try to access the members of the derived class using this reference you will get a compile time error.Example Live Demointerface ... Read More
Maruthi Krishna
198 Views
When you try to handle an exception (checked) thrown by a particular method, you need to catch it using the Exception class or super class of the Exception occurred.In the same way while overriding the method of a super class, if it throws an exception −The method in the sub-class ... Read More
Maruthi Krishna
906 Views
An interface in Java is a specification of method prototypes. Whenever you need to guide the programmer or, make a contract specifying how the methods and fields of a type should be you can define an interface.To create an object of this type you need to implement this interface, provide ... Read More
Maruthi Krishna
1K+ Views
You can override the toString() method of the Object class but, if you are creating an object array of a particular class and want to print the contents of this array by overriding the toString() method instead of the, you cannot do that there is no solution for that in ... Read More
Maruthi Krishna
2K+ Views
You can retrieve the contents of a collection object in three ways −Using for each loopThe foreach loop or enhanced for loop, which enables you to traverse the complete collection object sequentially.Example Live Demoimport java.util.ArrayList; public class RetrievingData { public static void main(String[] args) { ArrayList ... Read More
Maruthi Krishna
182 Views
By adding each element of the arrayThe add() method of the ArrayList class accepts an element and adds it to the current array list. To convert an array to array list using this method −Get the string array.Create an empty ArrayList object.Add each element of the array to the ArrayList.Print ... Read More