0% found this document useful (0 votes)
26 views13 pages

PPTINDRUSTIAL

The document provides an introduction and overview of Java programming including its history, implementation process, operators, variables, data types, arrays, classes and objects. It discusses the basic concepts of Java and provides examples of each.

Uploaded by

thakurshourav74
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views13 pages

PPTINDRUSTIAL

The document provides an introduction and overview of Java programming including its history, implementation process, operators, variables, data types, arrays, classes and objects. It discusses the basic concepts of Java and provides examples of each.

Uploaded by

thakurshourav74
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

GOVT.

POLYTECHNIC HAMIRPUR
INDUSTRY TRAINING REPORT
ON
JAVA PROGRAMMING. FROM

SUBMITTED TO GOVT. POLYTECHNIC HAMIRPUR IN PARTIAL FULFILLMENT OF

THE DIPLOMA OF COMPUTER ENGG.

SESSION: AUG-DEC 2023


SUBMITTED BY –
SHOURAV THAKUR

GUIDED BY- MR.VINEY


(MOON LIGHT COMMERCIAL COLLEGE BIJHARI)
TRAINING OBJECTIVE
To get exposed to the training environment. To have a basic
understanding of the culture , work ethics and trade related work
practices at the organization.
To have an opportunity to observe the processes,
procedures and standards that the industry uses to ensure quality,
productivity and economy of the products or services that it
undertakes and get a firsthand experience to work within the
industry.
To relate my current level of knowledge with the industrial
experience in the form of generating reports on the basis of
observation and generates a model of its operations or processes or
work flow.
CONTENT.
1.INTRODUCTION TO JAVA

2.OPERATORS IN JAVA

3.VARIABLES IN JAVA

4.DATA TYPE IN JAVA

5.ARRAY IN JAVA

6.CLASS AND OBJECT IN JAVA


INTRODUCTION TO JAVA
Java is a class-based, object-oriented programming language that is designed to have as few implementation
dependencies as possible. It is intended to let application developers write once, and run anywhere (WORA), meaning
that compiled Java code can run on all platforms that support Java without the need for recompilation. Java was first
released in 1995 and is widely used for developing applications for desktop, web, and mobile devices. Java is known for
its simplicity, robustness, and security features, making it a popular choice for enterprise-level applications.
JAVA was developed by James Gosling at Sun Microsystems Inc in the year 1995 and later acquired by Oracle
Corporation. It is a simple programming language. Java makes writing, compiling, and debugging programming easy. It
helps to create reusable code and modular programs. Java is a class-based, object-oriented programming language and is
designed to have as few implementation dependencies as possible. A general-purpose programming language made for
developers to write once run anywhere that is compiled Java code can run on all platforms that support Java. Java
applications are compiled to byte code that can run on any Java Virtual Machine. The syntax of Java is similar to c/c++.
History: Java’s history is very interesting. It is a programming language created in 1991. James Gosling, Mike
Sheridan, and Patrick Naughton, a team of Sun engineers known as the Green team initiated the Java language in
1991. Sun Microsystems released its first public implementation in 1996 as Java 1.0. It provides no-cost -run-times on
popular platforms. Java1.0 compiler was re-written in Java by Arthur Van Hoff to strictly comply with its specifications.
With the arrival of Java 2, new versions had multiple configurations built for different types of platform.
Implementation of a Java application program involves a following step. They include:
1. Creating the program
2. Compiling the program
3. Running the program

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.

3. Short Data Type


The short data type is a 16-bit signed two’s complement integer. Similar to byte, use a short to save memory in large
arrays, in situations where the memory savings actually matters.
4. Integer Data Type
It is a 32-bit signed two’s complement integer.
5. Long Data Type
The range of a long is quite large. The long data type is a 64-bit two’s complement integer and is useful for those
occasions where an int type is not large enough to hold the desired value. The size of the Long Datatype is 8 bytes (64
bits).
6. Float Data Type
The float data type is a single-precision 32-bit IEEE 754 floating-point. Use a float (instead of double) if you need to save
memory in large arrays of floating-point numbers. The size of the float data type is 4 bytes (32 bits).
7. Double Data Type
The double data type is a double-precision 64-bit IEEE 754 floating-point. For decimal values, this data
type is generally the default choice. The size of the double data type is 8 bytes or 64 bits.
8. Char Data Type
The char data type is a single 16-bit Unicode character with the size of 2 bytes (16 bits).
Arrays in Java
In Java, Array is a group of like-typed variables referred to by a common name. Arrays in Java work
differently than they do in C/C++. Following are some important points about Java arrays.
>ARRAY IN JAVA
•In Java, all arrays are dynamically allocated. (discussed below)
•Arrays may be stored in contiguous memory [consecutive memory locations].
•Since arrays are objects in Java, we can find their length using the object property length. This is different
from C/C++, where we find length using sizeof.
•A Java array variable can also be declared like other variables with [] after the data type.
•The variables in the array are ordered, and each has an index beginning with 0.
•Java array can also be used as a static field, a local variable, or a method parameter.
An array can contain primitives (int, char, etc.) and object (or non-primitive) references of a class depending
on the definition of the array. In the case of primitive data types, the actual values might be stored in
contiguous memory locations(JVM does not guarantee this behavior). In the case of class objects,
the actual objects are stored in a heap segment.
Types of Array in Java
In Java, there are two types of arrays:
1.Single-Dimensional Array
2.Two-dimentional Array
3.Multi-Dimensional Array
1. Single Dimensional Array
An array that has only one subscript or one dimension is known as a single-dimensional array. It is just a list of the
same data type variables. One dimensional array can be of either one row and multiple columns or multiple rows and
one column. For instance, a student's marks in five subjects indicate a single-dimensional array.
2.Two Dimensional Arrays: Two-dimensional arrays are the more frequently used type of array in Java. They form a
matrix of rows and columns and find applications in a lot of fields outside development, such as simulation, robotics,
and machine learning.
3.Multi-Dimensional Arrays: Arrays can also have more than two dimensions. While arrays with multiple dimensions
are not easy to visualize, their applications are only increasing by the day. They can also hold large amounts of data,
which is a useful feature when it comes to data analysis.
Classes and Objects in Java
In Java, classes and objects are basic concepts of Object Oriented Programming (OOPs) that are used to represent real-world concepts and entities. The
class represents a group of objects having similar properties and behavior. For example, the animal type Dog is a class while a particular dog
named Tommy is an object of the Dog class.
In this article, we will discuss Java objects and classes and how to implement them in our program.
Java Classes
A class in Java is a set of objects which shares common characteristics/ behavior and common properties/ attributes. It is a user-defined blueprint or
prototype from which objects are created. For example, Student is a class while a particular student named Ravi is an object.
Properties of Java Classes
1.Class is not a real-world entity. It is just a template or blueprint or prototype from which objects are created.
2.Class does not occupy memory.
3.Class is a group of variables of different data types and a group of methods.
4.A Class in Java can contain:
4. Data member
5. Method
6. Constructor
7. Nested Class
8. Interface
Java Objects
An object in Java is a basic unit of Object-Oriented Programming and represents real-life entities. Objects are the instances of a class that are created to use
the attributes and methods of a class. A typical Java program creates many objects, which as you know, interact by invoking methods. An object consists
of :
State: It is represented by attributes of an object. It also reflects the properties of an object.
2.Behavior: It is represented by the methods of an object. It also reflects the response of an object with other objects.
3.Identity: It gives a unique name to an object and enables one object to interact with other objects.
Objects correspond to things found in the real world. For example, a graphics program may have objects such as
“circle”, “square”, and “menu”. An online shopping system might have objects such as “shopping cart”, “customer”,
and “product”.
Declaring Objects (Also called instantiating a class)
When an object of a class is created, the class is said to be instantiated. All the instances share the attributes and the
behavior of the class. But the values of those attributes, i.e. the state are unique for each object. A single class may
have any number of instances
Declaring Objects (Also called instantiating a class)
When an object of a class is created, the class is said to be instantiated. All the instances share the attributes and the
behavior of the class. But the values of those attributes, i.e. the state are unique for each object. A single class may
have any number of instances
If we declare a reference variable(tuffy) like this, its value will be undetermined(null) until an object is actually
created and assigned to it. Simply declaring a reference variable does not create an object.
Initializing a Java object
The new operator instantiates a class by allocating memory for a new object and returning a reference to that
memory. The new operator also invokes the class constructor.

You might also like