Java Full Stack
Java Full Stack
Java Full Stack
ENGINEERING
(Affiliated to DBATU, Lonere)
Dhamangaon Road, Yavatmal-
445106
Submitted by
Samiksha Ajayrao Jadhav 2110121372521
A report submitted in partial fulfilment of the requirement for the Award of Degree of
Bachelor Of Technology,
1
GOVERNMENT COLLEGE OF
ENGINEERING
(Affiliated to DBATU, Lonere)
Dhamangaon Road, Yavatmal-445106
CERTIFICATE
Certified that the course work entitled “Core Java” is a bona-fide work
Carried out by
Samiksha Ajayrao Jadhav
The report has been approved as it satisfies the academic requirements in respect of
Course work prescribed for the course
…………….. …………
Prof.M.N.Ingole Prof.S.S.Thorat
Guided by Head of Department
2
ACKNOWLEDGMENT
This opportunity of course was a golden chance for learning the professional Javafull
stack. I have gained a lot of skills during the tenure of this course. I express
mydeepest gratitude and special thanks to my online tutors for giving their precious
time.I have seen this opportunity as a big milestone in my career development. This
course would help me for shaping my career. I will try my best to gain skills and
knowledge inbest possible way and will continue to work on their development.
I would like to thank ‘Pantech Solutions ’ for giving me this platform to complete my
courseand also my professors for guiding me , time to time.
3
ABSTRACT
This training has helped me to learn and development the concepts of Java. The
training included online video content along with quiz, assignments and module tests
tocheck my progress. The training program has helped me to walk through all thejava
concepts and implement those concepts. This has increased my theoretical as well as
practical knowledge by creating various projects like a temperature converter desktop
application and a Java game (cross- platform desktop application) from scratchusing
the Java FX platform. Thus, covering not only java but also GUI based JavaFX
platform for creating games.
4
INDEX
Certificate
Acknowledgement
Abstract
CHAPRTER 1: INTRODUCTION
CONCLUSION
5
CHAPTER 1
INTRODUCTION
Fig. Java
Internet is the network of networks between different types of computers located at
different places to transmit information. Information can reach to any place in the
world quickly at a cheaper rate through the Internet. Thus, the Internet has made the
world a global village for information exchange. The emerging infrastructure of
electronic devices and interconnected computer networks create an environment that
presents new challenges to software industries. for this emerging computing
environment, Java process to be a well-suited programming language, it is found
suitable for networked environments involving a great variety of computer and
devices.
Java has many characteristics that have contributed to its popularity:
> Platform independence - Many languages are compatible with only one platform.
Java
was specifically designed so that it would run on any computer, regardless if it was
running Windows, Linux, Mac, Unix or any of the other operating systems.
> Simple and easy to use - Java's creators tried to design it so code could be written
efficiently and easily.
6
programs to applets to Swing windows (basically, sophisticated graphical user
interfaces).
7
CHAPTER 2
INTRODUCTION TO JAVA PLATFORM
When the code is run by the user, it is processed by something called for Virtual
Machine (JVM). The JVM is essentially an interpreter for It goes through the bytecode
and runs it. There are different anions of JVM that are compatible with each OS and
can run the same code. Thes virtually no difference for the end-user, but this makes
are programmers doing software development.
In 2006 Sun started to make Java available under the GNU General Public License
(GPL). Oracle continues this project called OpenJDK
8
2.4 Java Runtime Environment vs. Java Development Kit
A Java distribution comes typically in two flavours, the Java Runtime Environment
(JRE) and the Java Development Kit (JDK).
The Java runtime environment (JRE) consists of the JVM and the Java class libraries
and contains the necessary functionality to start Java programs.
The JDK contains in addition the development tools necessary to create Java
programs. The JDK consists therefore of a Java compiler, the Java virtual machine,
and the Java class libraries.
9
CHAPTER 3
INSTALLATION OF JAVA
Java might already be installed on your machine. You can test this by opening a
console (if you are using Windows. Win R, enter cmd and press Enter) and by typing
in the following command:
If Java is correctly installed, you should see some information about your Java
installation. If the command line returns the information that the program could not be
found, you have to install Java.
Before installing the Java Development Kit (JDK), you should probably know what It
is distributed by Oracle. It contains the core libraries and compiler required to develop
Java. The JDK should not be confused with the JRE (Java Runtime Environment). The
RE is a JVM for running, as opposed to compiling. Java programs.
10
3.4 Downloading and Installing:
11
CHAPTER 4
BASICS: CLASS AND OBJECT
4.1 Class:
Def: Template that describes the data and behaviour associated with an instance of
that class. In Java source code a class is defined by the class keyword and must start
with a capital letter. The body of a class is surrounded by {}.
The data associated with a class is stored in variables; the behaviour associated to a
class or object is implemented with methods.
A class is contained in a Java source file with the same name as the class plus the java,
extension.
4.2 Object:
Def.: An object is an instance of a class.
The object is the real element which has data and can perform actions. Each object is
created based on the class definition.
4.3 Inheritance:
A class can be derived from another class. In this case this class is called a subclass.
Another common phrase is that a class extends another class.
The class from which the subclass is derived is called a superclass. Inheritance allows
a class to inherit the behaviour and data definitions of another class.
The following codes demonstrate how a class can extend another class. In Java a class
can extend a maximum of one class.
12
CHAPTER 5
VARIABLES AND METHODS
5.1 Variable
Variables allow the Java program to store values during the runtime of the program.
A variable can either be a primitive variable or a reference variable. A primitive
variable contains value while the reference variable contains a reference (pointer) to
the object. Hence if you compare two reference variables, you compare if both point
to the same object. To compare objects use the objects. equals(object2) method call.
Local (stack) variable declarations cannot have access modifiers. Final is the only modifier
available to local variables. This modifier defines that the variable cannot be changed after first
assignment. Local variables do not get default values, so they must be initialized before use.
5.1.3 Static Variables
When a variable is declared as static, then a single copy of the variable is created and shared
among all objects at a class level. Static variables are, essentially, global variables. All instances
of the class share the same static variable.
5.2 Methods
A method is a block of code with parameters and a return value. It can be called on the
object.
Import java.util.*;
Class MyClassMehod{
Public static void main(String [] args)
{
13
Void tester (String s) {
System.out.println(“Hello World!!”);
}
}
Method can be declared with var-args. In this case the method declares a parameter
which accepts from zero to many arguments (syntax: type.. name;) A method can only
have one var- args parameter and this must be the last parameter in the method.
Main method
A public static method with the following signature can be used to start a Java
application. Such a method is typically called main method.
5.3 Constructor
A class contains constructors that are invoked to create objects based on the class
definition. Constructor declarations look like method declarations except that they use
the name of the class and have no return type. A class can have several constructors
with different parameters. Each class must define at least one constructor.
5.4 Polymorphism
The word polymorphism means having many forms. In simple words, we can define
Java Polymorphism as the ability of a message to be displayed in more than one
form. In this article, we will learn what is polymorphism and it’s type.
Real-life Illustration of Polymorphism in Java: A person at the same time can have
different characteristics. Like a man at the same time is a father, a husband, and an
employee. So the same person possesses different behaviours in different situations.
This is called polymorphism.
14
CHAPTER 6
Compile-time Polymorphism
Runtime Polymorphism
When there are multiple functions with the same name but different parametersthen
these functions are said to be overloaded. Functions can be overloaded bychanges in the number
of arguments or/and a change in the type of arguments.
2) Runtime Polymorphism
In runtime polymorphism, the compiler resolves the object at run time and then it
decides which function call should be associated with that object. It is also known as dynamic or
late binding polymorphism. This type of polymorphism is executed through virtual functions and
function overriding
15
CHAPTER 7
Java Arrays
Normally, an array is a collection of similar type of elements which has contiguous
memory location.
Java array is an object which contains elements of a similar data type. Additionally,
The elements of an array are stored in a contiguous memory location. It is a data
structure where we store similar elements. We can store only a fixed set of elements in
a Java array.
Array in Java is index-based, the first element of the array is stored at the 0th index,
2nd element is stored on 1st index and so on.
16
CHAPTER 8
There are multiple types of operators in Java all are mentioned below:
1. Arithmetic Operators
They are used to perform simple arithmetic operations on primitive
data types.
2. Assignment Operator
‘=’ Assignment operator is used to assign a value to any variable. It has right-to-left
associativity, i.e. value given on the right-hand side of the operator is assigned to the
variable on the left, and therefore right-hand side value must be declared before
using it or should be a constant.
The general format of the assignment operator is:
variable = value;
+=, for adding the left operand with the right operand and then assigning
it to the variable on the left.
-=, for subtracting the right operand from the left operand and then
assigning it to the variable on the left.
*=, for multiplying the left operand with the right operand and then
assigning it to the variable on the left.
17
3. Relational Operators
These operators are used to check for relations like equality, greater than, and less
than. They return Boolean results after the comparison and are extensively used in
looping statements as well as conditional if-else statements. The general format is,
variable relational operators value
4. Logical Operators
These operators are used to perform “logical AND” and “logical OR” operations, i.e.,
a function similar to AND gate and OR gate in digital electronics. One thing to keep
in mind is the second condition is not evaluated if the first one is false, i.e., it has a
short- circuiting effect. Used extensively to test for several conditions for making a
decision. Java also has “Logical NOT”, which returns true when the condition is false
and vice- versa
Conditional operators are:
&&, Logical AND: returns true when both conditions are true.
||, Logical OR: returns true if at least one condition is true.
!, Logical NOT: returns true when a condition is false and vice-versa
5. Bitwise Operators
These operators are used to perform the manipulation of individual bits of a number.
They can be used with any of the integer types. They are used when performing
update and query operations of the Binary indexed trees.
&, Bitwise AND operator: returns bit by bit AND of input value
|, Bitwise OR operator: returns bit by bit OR of input values.
^, Bitwise XOR operator: returns bit-by-bit XOR of input values
18
6. Shift Operators
These operators are used to shift the bits of a number left or right, thereby multiplying
or dividing the number by two, respectively. They can be used when we have to
multiply or divide a number by two. General format-
Number shift op number of places to shift;
<<, Left shift operator: shifts the bits of the number to the left and fills
0 on voids left as a result. Similar effect as multiplying the number with
some power of two.
>>, Signed Right shift operator: shifts the bits of the number to the right
and fills 0 on voids left as a result. The leftmost bit depends on the sign of
the initial number. Similar effect to dividing the number with some power
of two.
>>>, Unsigned Right shift operator: shifts the bits of the number to the
right and fills 0 on voids left as a result. The leftmost bit is set to 0.
1. Instance of operator
The instance of the operator is used for type checking. It can be used to test if an
object is an instance of a class, a subclass, or an interface. General format-
object instance of class/subclass/interface.
19
CONCLUSION
20