If we talk about file handling, it is considered as one of the most significant parts of any application because it allows us to create, modify, read and remove any file.
This tutorial will provi...
Data abstraction is the characteristic feature, where just the most important features are shown to the user. The user is kept unaware of trivial or non-essential details. For example, an automobil...
An inner class in Java is defined as a class that is declared inside another class. Inner classes are often used to create helper classes, such as views or adapters that are used by the outer class...
Polymorphism means many forms and it occurs when we have many classes that are related to each other by inheritance. There are two types of polymorphism in Java: Compile time polymorphism and run-t...
Inheritance in Java is a mechanism in which one object acquires all the properties and behaviors of a parent object. In Java, a class can inherit attributes and methods from another class. The clas...
A modifier in Java is used to define the accessibility and behavior of the classes, their constructors, fields, and methods. There are two types of modifiers in Java: access and non-access. The acc...
Encapsulation is the process by which data and code acting upon them are integrated as a single unit. Using encapsulation, we can also hide the class data members from other classes. These data mem...
Java is an object-oriented programming language. The core concept of the object-oriented approach is to break complex problems into small objects.
An object is any entity that has a state or beha...
In Java, the function call mechanism supports the possibility of having a method call itself. This functionality is called recursion.
For example, suppose we want to sum the integers from 0 to som...
In Java, a scope defines where a certain method or variable is accessible in a program. Java programs are organized in the form of classes. Every class is part of some package. Java scope rules ca...
In Java, two or more methods may have the same name if they differ in parameters. These methods are called overloaded methods and this feature is called method overloading.
Advantages of Method Ov...
A parameter in the Java method is a variable name with type which is declared within the method signature. The list of parameters is enclosed within the parentheses. Each parameter consists of two...
A method is a collection of statements that are grouped together to perform some specific task and return the result to the caller. It provides the reusability of code. We can also easily modify co...
Arrays are used to store multiple values in a single variable, instead of declaring multiple variables for each value. The following are some important points about java arrays.
In Java, all arr...
Java break and continue statements are used to manage program flow. We can use them in a loop to control loop iterations. These statements enables us to control loop and switch statements by enabli...
When you know exactly how many times you want to loop through a block of code, use a for loop instead of a while loop.
Below is the syntax of a while loop.
for(statement1; statement2; statement...
Java while loop is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition. The while loop can be thought of as a repeating if statement. While loop ...
Switch case statement is used when we have number of options(or choices) and we may need to perform a different task for each choice. The syntax of switch case statement looks like this:
switch(...
The if...else statement is a control flow statement in Java. In programming, we use if..else statement to run a block of code among more than one alternatives.
For example, assigning grades(A,B,C...
A boolean variable in Java can be created using the boolean keyword. Unlike C++, a numerical character cannot be assigned to a boolean variable in Java, only true and false can be used. The strings...