The operators in Java represent the operations, i.e, operators perform operations on the operands. Let us discuss the various operators in Java. Arithmetic Operators: These operators are for basic arithmetic operations They are additions, subtraction, multiplication, division, and remainder. Each of these operators is binary, i.e, it requires two values (operands) to calculate the final […]
April 28, 2022 | Java | No comments
In programming, a constant is an immutable entity. To put it another way, the value cannot be altered. In a program, we often want to give a name to a constant value. For instance, we might have a fixed tax rate of 0.030 for goods and a tax rate of 0.020 for services. These are […]
April 26, 2022 | Java | No comments
Variables represent named storage locations, whose values can be manipulated during the program run. For instance, to store the name of a student and marks of a student during a program run, we require storage locations that are too named so that these can be distinguished easily. Declaration of variables: The declaration of a variable […]
April 21, 2022 | Java | No comments
Data types are means to identify the type of data and associated operations of handling it. Java, like any other language, provides ways and facilities to handle different types of data by providing data types. Java data types are of two types: Primitive (or intrinsic) data types Reference data types Primitive data types come as […]
April 21, 2022 | Java | No comments
Java allows us to have certain non-graphic characters in character constants. (non-graphic characters are those which cannot be typed directly from the keyboard, e.g, backspace, tabs, carriage return, etc.). These characters are represented with the use of an escape sequence, which is represented by a backslash(\) followed by one or more characters. The following table […]
April 21, 2022 | Java | No comments
Literals(often referred to as constants) are data items that are fixed data values. Java allows several kinds of literal: integer-literal floating-literal boolean-literal character-literal string-literal null-literal Integer Literal: Integer Literals are whole numbers without any fractional part. The method of writing integer constants has been specified in the following rule: An integer constant must have at […]
April 21, 2022 | Java | No comments
Identifiers are fundamental building blocks of a program and are used as the general terminology for the names given to different parts of the program viz. variables, objects, classes, functions, arrays, etc. Identifier forming rules of Java state the following: Identifiers can have alphabets, digits, and underscore and dollar sign characters. They must not be […]
April 21, 2022 | Java | No comments
Token The smallest individual unit in a program is known as a token. In fact, every unit that makes a sentence is a token. Java has the following token: Keywords Identifiers Literals Punctuators Operators Keywords Keywords are the words that convey a special meaning to the language compiler. These are reserved for special purposes and […]
April 21, 2022 | Java | No comments
Requirement for Java Hello World Program: Install the JDK if you don’t have installed it, download the JDK and install it. Set path of the jdk/bin directory.Setting CLASSPATH in Java Create the Java program Compile and run the Java program Hello World Example: Save the above file as Hello.java. In the terminal: To compile: javac Hello.java To […]
April 19, 2022 | Java | No comments
Let us now compare Java Virtual Machine, JRE, and JDK. The following are the key distinctions between JDK, JRE, and JVM. Sr. No. Key JDK JRE JVM 1 Definition The Java Development Kit (JDK) is a software development kit for creating Java applications. JDK includes a number of development tools in addition to JRE (compilers, […]
April 19, 2022 | Java | No comments