PPTINDRUSTIAL
PPTINDRUSTIAL
POLYTECHNIC HAMIRPUR
INDUSTRY TRAINING REPORT
ON
JAVA PROGRAMMING. FROM
2.OPERATORS IN JAVA
3.VARIABLES IN JAVA
5.ARRAY IN JAVA
Remember that, before we begin creating the program, the Java Development Kit (JDK)
must be properly installed on our system and also path will be set.
• Creating Program
We can create a program using Text Editor (Notepad) or IDE (NetBeans)
class Test
{
public static void main(String []args)
{
System.out.println(“My First Java Program.”);
}
};
File -> Save -> d:\Test.java
.
• Compiling the program
To compile the program, we must run the Java compiler (javac), with the name of the source file on “command
prompt” like as follows
If everything is OK, the “javac” compiler creates a file called “Test.class” containing byte code of the program.
• Running the program
We need to use the Java Interpreter to run a program
>OPERATORS IN JAVA:
Java provides many types of operators which can be used according to the need. They
are classified based on the functionality they provide. In this article, we will learn
about Java Operators and learn all their types.
What are the Java Operators?
Operators in Java are the symbols used for performing specific operations in Java.
Operators make tasks like addition, multiplication, etc which look easy although the
implementation of these tasks is quite complex.
Types of Operators in Java
There are multiple types of operators in Java all are mentioned below:
1.Arithmetic Operators
2.Unary Operators
3.Assignment Operator
4.Relational Operators
5.Logical Operators
6.Ternary Operator
7.Bitwise Operators
8.Shift Operators
9.instance of operator
Java Data Types
Java is statically typed and also a strongly typed language because, in Java, each type of data (such as integer, character,
hexadecimal, packed decimal, and so forth) is predefined as part of the programming language and all constants or variables
defined for a given program must be described with one of the Java data types.
Data Types in Java
Data types in Java are of different sizes and values that can be stored in the variable that is made as per convenience and
circumstances to cover up all test cases. Java has two categories in which data types are segregated
1.Primitive Data Type: such as boolean, char, int, short, byte, long, float, and double
2.Non-Primitive Data Type or Object Data type: such as String, Array, etc.
1. Boolean Data Type
Boolean data type represents only one bit of information either true or false which is intended to represent the two truth
values of logic and Boolean algebra, but the size of the boolean data type is virtual machine-dependent. Values of type
boolean are not converted implicitly or explicitly (with casts) to any other type. But the programmer can easily write
conversion code.
2. Byte Data Type
The byte data type is an 8-bit signed two’s complement integer. The byte data type is useful for saving memory in large
arrays.