Java – Object-Oriented Programming concept

Object-oriented programming: It is the concept of using objects in programming. It is a paradigm that uses objects and classes that aim to implement real-world entities. The entities such as inheritance, abstraction, polymorphism, etc that are used in programming. The main goal of an OOP is to tie together the data and its method in a single … Read more

Java – Inheritance

It is one of the main features of Object-Oriented Programming (OOP). Inheritance is one of the processes or mechanisms in OOP in which one class(sub-class) acquires the properties(data members) and functionalities(methods) of another class(parent-class). Importance of Inheritance: For Code Reusability. For Method Overriding (to achieve runtime polymorphism). Important terms: Super Class: The class whose properties and functionalities are … Read more

Java – call by value and call by reference

call by value in Java: If a method is to be called by passing a parameter as a value then it is said to be Call by Value. Here the changes made to the passed parameter do not affect the called method. Example of call by value: Output: call by reference in Java: If a … Read more

Java Keywords & Identifiers

Keywords: Keywords in Java are also known as reserved words, are already defined in Java with a predefined meaning. These words cannot be used with variables or object name. Example of using integer Keyword: List of Keywords used in Java are shown in the table: Keywords abstract assert boolean break byte case catch char do double else … Read more

Java – Type conversion/Type Casting

Type Casting is assigning a value of one data-type to a variable of another data-type. When a value is assigned to another variable, their types might not be compatible with each other to store that value. For this situation, they need to be cast or converted explicitly. But if they are compatible then java converts the … Read more

Java – Data Types

What are Data Types in Java? Data types specify the varying sizes and values in the variables that can be stored. That is every variable is assigned by data-types according to the need. And based on their respective data-types, the operating system allocates memory to that data-types. There are two data types in Java: Primitive data types: The … Read more

Java – Scope of a Variable

What is scope of a variables in Java? Scope refers to the visibility of variables. In other words, a scope is a section of a program, and the scope of variables refers to the section of the program where the variables are visible. Variables are declared and used within that region. Also variable declared within the … Read more

Java – Operator & Expression

Operators are used to perform operations on variables and values or to manipulate them. The operation is performed with two operand and operators to provide what action need to perform. Example: In the above example, 10 and 5 are operands and + is the operation performed between these two operands. Java provides numbers of operation and these … Read more

Java – Operator Precedence and Associativity

What are Precedence and Associativity? Precedence and Associativity are the rules that are used to determine the operators with the highest priority in evaluating an equation that contains different operations. For example: In this example, x is assigned as 20, not 30 that’s because operator * has higher precedence than +, and hence it first gets multiplied … Read more

Java Variables

What is Variable in Java? The variable is the basic unit of storage which holds the value while the program is executed. We can also say that it is a name given to the memory location. A variable is defined by data-types provided by Java. It may be string, int, float, char, and boolean. Declaring a Variable … Read more