5. Methods in Java

In general, a method is a way to perform some task. Similarly, the method in Java is a collection of instructions that performs a specific task. It provides the reusability of code. We can also easily modify code using methods. In this section, we will learn what is a method in Java, types of methods, method declaration, and how to call a method… Read More »

6. Constructor in Java

In Java, a constructor is a block of codes similar to the method. It is called when an instance of the classis created. At the time of calling constructor, memory for the object is allocated in the memory. It is a special type of method which is used to initialize the object. Every time an object is… Read More »

4. Data types in Java

Data types specify the different sizes and values that can be stored in the variable. There are two types of data types in Java: Primitive data types: The primitive data types include boolean, char, byte, short, int, long, float and double. Non-primitive data types: The non-primitive data types include Classes, Interfaces, and Arrays. Java Primitive… Read More »

3. Packages in Java

Java Package A java package is a group of similar types of classes, interfaces and sub-packages. Package in java can be categorized in two form, built-in package and user-defined package. There are many built-in packages such as java, lang, awt, javax, swing, net, io, util, sql etc. Here, we will have the detailed learning of… Read More »

2.1 Naming convention of Java

Java naming convention is a rule to follow as you decide what to name your identifiers such as class, package, variable, constant, method, etc. But, it is not forced to follow. So, it is known as convention not rule. These conventions are suggested by several Java communities such as Sun Micro systems and Netscape. All… Read More »

1.11 Control Statements

Java compiler executes the code from top to bottom. The statements in the code are executed according to the order in which they appear. However, Java provides statements that can be used to control the flow of Java code. Such statements are called control flow statements. It is one of the fundamental features of Java,… Read More »

1.10 Keywords

Java keywords are also known as reserved words. Keywords are particular words that act as a key to a code. These are predefined words by Java so they cannot be used as a variable or object name or class name. List of Java Keywords A list of Java keywords or reserved words are given below:… Read More »

1.9 Operators

Operator in Java is a symbol that is used to perform operations. For example: +, -, *, / etc. There are many types of operators in Java which are given below: Unary Operator, Arithmetic Operator, Shift Operator, Relational Operator, Bitwise Operator, Logical Operator, Ternary Operator and Assignment Operator. Java Operator Precedence Operator Type Category Precedence Unary postfix expr++… Read More »

1.8 Unicode System

Unicode is a universal international standard character encoding that is capable of representing most of the world’s written languages. Why java uses Unicode System? Before Unicode, there were many language standards: ASCII (American Standard Code for Information Interchange) for the United States.ISO 8859-1 for Western European Language.KOI-8 for Russian.GB18030 and BIG-5 for chinese, and so on. Problem This caused… Read More »