You are on page 1of 22

REPORT OF INDUSTRIAL TRAINING

ON
“CORE JAVA”

By, Adarsh Kumar


ECE B
252001107
UIET Kurukshetra

Submitted to,
Krishna Pandey Sir

Industrial Training at :
Training Certificate:
Table of Content:

1. Getting Started with Java………………………………….………………………………4


1.1 Features of Java………………………………………………..………………….4
1.2 JDK, JRE & JVM………………………………..…………..……………………4
1.3 Variables……………………………………..……………………………………5
1.4 Data Types…………………………..…………………………………………….5
1.5 Operators……………..…………………………………………………………...6
1.6 Conditional Statement…………………………………………………………….6

2. Basic Concepts in Java……..……………………………………………………………...6


2.1 Iterators…………………………………………………………………………..6
2.2 Arrays……………………………………………………………………………7
2.3 String…………………………………………………………………………….8
2.4 Method…………………………………………………………………………..8
2.5 Exception Handling…………………………………………………………….10

3. Object Oriented Programming………………………………………………...................11


3.1 Classes & Objects………………………………………………………………11
3.2 Constructor……………………………………………………………………..13
3.3 Inheritance……………………………………………………………………...16
3.4 Polymorphism………..………………………………………………………...18
3.5 Abstract Class…………………………………………………………………..20
3.6 Interface………………………………………………………………………...20

4. Conclusion………...………………………………………………………………………22
Core Java

Abstract – Java is one of the most popular v. Secured


programming languages as it can be used to vi. Robust
design customized applications that are light
and fast and serve a variety of purposes. Java vii. Architecture neutral
is one of the most popular programming viii. Interpreted
languages in the world. It is used by some 9
ix. High Performance
million developers and it runs on around 7
billion devices worldwide according to Oracle x. Multithreaded
blogs. I learnt about various data types & xi. Distributed
Operators. After that, I learnt about various
Iterators, like for-loop, while loop, do-while xii. Dynamic
loop, etc. Apart from this, I have learnt about
Methods, its Overriding & Overloading.
I also learnt about Object Oriented B. JDK, JRE & JVM
Programming in Java, in which I learnt
Interface, Classes & Objects, Polymorphism, i. JVM
Inheritance & Abstract Class.
JVM (Java Virtual Machine) is an abstract
Keywords – Interface, Inheritance, JVM, JRE,
machine.
JDK, Constructor, Abstract class.
The JVM performs the following main
tasks:
I. INTRODUCTION
o Loads code
Java is a programming language and a platform.
o Verifies code
Java is a high level, robust, object-oriented and
secure programming language. o Executes code

Java was developed by Sun Microsystems (which o Provides runtime environment


is now the subsidiary of Oracle) in the year 1995.
ii. JRE
James Gosling is known as the father of Java.
Before Java, its name was Oak. JRE is an acronym for Java Runtime
Environment. The Java Runtime
A. Features of Java
Environment is a set of software tools
A list of the most important features of the Java which are used for developing Java
language is given below: applications. It is used to provide the
runtime environment. It is the
i. Simple
implementation of JVM. It physically
ii. Object-Oriented
exists. It contains a set of libraries + other
iii. Portable
files that JVM uses at runtime.
iv. Platform independent
and the other methods in the class are not
even aware that the variable exists. A local
variable cannot be defined with "static"
keyword.

ii. instance variable


A variable declared inside the class but
outside the body of the method, is called
an instance variable. It is not declared as
static.
It is called an instance variable because its
value is instance-specific and is not shared
iii. JDK among instances.

JDK is an acronym for Java Development iii. static variable


Kit. The Java Development Kit (JDK) is a A variable that is declared as static is
called a static variable. It cannot be local.
software development environment which You can create a single copy of the static
is used to develop Java applications and variable and share it among all the
instances of the class. Memory allocation
applets. It physically exists. It contains
for static variables happens only once
JRE + development tools. when the class is loaded in the memory.

D. DATA TYPES

Data types specify the different sizes and values


that can be stored in the variable. There are two
types of data types in Java:
i. Primitive data types: The primitive data
types include boolean, char, byte, short,
int, long, float and double.
ii. Non-primitive data types: The non-
primitive data types include Classes,
C. VARIABLES
Interfaces, and Arrays.
A variable is the name of a reserved area
allocated in memory. In other words, it is a
name of the memory location. It is a
combination of "vary + able" which means
its value can be changed.

There are three types of variables in Java:


i. local variable
A variable declared inside the body of the
method is called local variable. You can
use this variable only within that method
Data Type Default Value Default size Logical logical AND &&

logical OR ||
boolean false 1 bit
Ternary ternary ?:

char '\u0000' 2 bytes Assignment assignment = += -= *= /=


%= &= ^= |=
<<= >>= >>>=
byte 0 1 byte

short 0 2 bytes F. CONDITIONAL STATEMENTS

int 0 4 bytes i. if-else statement


The Java if-else statement tests the
condition. It executes the if block if
long 0L 8 bytes
condition is true otherwise else
block is executed.
float 0.0f 4 bytes
ii. if-else-if ladder
double 0.0d 8 bytes The if-else-if ladder statement
executes one condition from
multiple statements.

E. OPERATORS iii. nested if statement


The nested if statement represents
Operator Type Category Precedence the if block within another if block.

Unary postfix expr++ expr-- iv. switch statement


The Java switch statement executes
prefix ++expr -- one statement from multiple
expr +expr - conditions. It is like if-else-if
expr ~ ! ladder statement.
Arithmetic multiplicative */%

additive +-
II. BASIC CONCEPTS IN JAVA
Shift shift << >> >>> A. ITERATORS
Relational comparison < > <= >=
instanceof
i. For-Loop
equality == != The Java for loop is used to
Bitwise bitwise AND & iterate a part of the program
several times. If the number of
bitwise ^
exclusive OR iteration is fixed, it is
recommended to use for loop.
bitwise |
inclusive OR
for (initialization; condition; iii. Do-while Loop
The Java do-while loop is used
increment/decrement) {
to iterate a part of the program
//statement or code to be executed
repeatedly, until the specified
} condition is true. If the number
of iteration is not fixed and you
For-each loop
must have to execute the loop
The for-each loop is used to traverse array or at least once, it is recommended
collection in Java. It is easier to use than to use a do-while loop.
simple for loop because we don't need to
increment value and use subscript notation. It Java do-while loop is called an
works on the basis of elements and not the exit control loop. Therefore,
index. It returns element one by one in the unlike while loop and for loop,
defined variable. the do-while check the

for(data_type variable : array_name){ condition at the end of loop


body. The Java do-while loop
//code to be executed
is executed at least once
} because condition is checked
after loop body.
ii. While-Loop
The Java while loop is used to
do {
iterate a part of the program
//code to be executed / loop
repeatedly until the specified
body
Boolean condition is true. As
//update statement
soon as the Boolean condition
} while (condition);
becomes false, the loop
automatically stops.
B. ARRAYS
The while loop is considered as
An array is a collection of similar type of
a repeating if statement. If the
elements which has contiguous memory
number of iteration is not fixed,
location.
it is recommended to use the
Java array is an object which contains
while loop.
elements of a similar data type.
while (condition) { Additionally, The elements of an array are

//code to be executed stored in a contiguous memory location. It


is a data structure where we store similar
Increment / decrement statement
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 char [] ch = {'a','d','a','r','s','h'};
index, 2nd element is stored on 1st index String s = new String(ch);
and so on.
There are two types of array: is same as:
i Single Dimensional Array
int a [ ] = new int[5]; String s = "adarsh";
//declaration and instantiation
a [0] = 10; //initialization Java String class provides a lot of methods
a [1] = 20; to perform operations on strings such as
a [2] = 70; compare(), concat(), equals(), split(),
a [3] = 40; length(), replace(), compareTo(), intern(),
a [4] = 50; substring() etc.
//traversing array
for (int i = 0; i < a.length ; i++) { D. METHOD
//length is the property of array A method is a block of code or collection
System.out.println(a [i] ); of statements or a set of code grouped
} together to perform a certain task or
operation. It is used to achieve the
ii Multidimensional Array reusability of code. We write a method
//declaring and initializing 2D array once and use it many times. We do not
int arr [ ][ ] = { {1,2,3} , require to write code again and again. It
{2,4,5}, also provides the easy modification and
{4,4,5} }; readability of code, just by adding or
//printing 2D array removing a chunk of code. The method is
for (int i = 0; i < 3; i++) { executed only when we call or invoke it.
for (int j = 0; j<3; j++) {
System.out.print(arr [i][j] +" "); The most important method in Java is the
} main() method.
System.out.println( );
}

C. STRING
In Java, string is basically an object that
represents sequence of char values. An
array of characters works same as Java
string. For example:
i Method Signature: Every method iv Method Name: It is a unique name
has a method signature. It is a part that is used to define the name of a
of the method declaration. It method. It must be corresponding
includes the method name and to the functionality of the method.
parameter list. Suppose, if we are creating a
method for subtraction of two
ii Access Specifier: Access specifier numbers, the method name must be
or modifier is the access type of the subtraction(). A method is invoked
method. It specifies the visibility of by its name.
the method. Java provides four
types of access specifier: v Parameter List: It is the list of
o Public: The method is accessible parameters separated by a comma
by all classes when we use public and enclosed in the pair of
specifier in our application. parentheses. It contains the data
o Private: When we use a private type and variable name. If the
access specifier, the method is method has no parameter, left the
accessible only in the classes in parentheses blank.
which it is defined.
o Protected: When we use protected vi Method Body: It is a part of the
access specifier, the method is method declaration. It contains all
accessible within the same package the actions to be performed. It is
or subclasses in a different enclosed within the pair of curly
package. braces.
o Default: When we do not use any
access specifier in the method Naming a Method
declaration, Java uses default
While defining a method, remember that the
access specifier by default. It is
method name must be a verb and start with a
visible only from the same package
lowercase letter. If the method name has more
only.
than two words, the first name must be a verb
iii Return Type: Return type is a data
followed by adjective or noun. In the multi-word
type that the method returns. It may
method name, the first letter of each word must be
have a primitive data type, object,
in uppercase except the first word. For example:
collection, void, etc. If the method
does not return anything, we use Single-word method name: sum(), area()

void keyword. Multi-word method name: areaOfCircle(),


stringComparision()
It is also possible that a method has the same statement 4;
name as another method name in the same class, it statement 5;//exception occurs
is known as method overloading. statement 6;

Method Overloading statement 7;


statement 8;
If a class has multiple methods having same name
Suppose there are 8 statements in a Java program
but different in parameters, it is known as Method
and an exception occurs at statement 5; the rest of
Overloading. the code will not be executed, i.e., statements 6 to
8 will not be executed. However, when we
If we have to perform only one operation, having perform exception handling, the rest of the
same name of the methods increases the statements will be executed. That is why we use
exception handling in Java.
readability of the program.
There are three types of exceptions namely:
Suppose you have to perform addition of the given
i. Checked Exception
numbers but there can be any number of The classes that directly inherit the
arguments, if you write the method such as Throwable class except
RuntimeException and Error are
a(int,int) for two parameters, and b(int,int,int) for known as checked exceptions. For
three parameters then it may be difficult for you as example, IOException, SQLException,
etc. Checked exceptions are checked at
well as other programmers to understand the
compile-time.
behavior of the method because its name differs.
ii. Unchecked Exception
So, we perform method overloading to figure out The classes that inherit the
the program quickly. RuntimeException are known as
unchecked exceptions. For example,
E. EXCEPTION HANDLING ArithmeticException,
NullPointerException,
The Exception Handling in Java is one of ArrayIndexOutOfBoundsException,
the powerful mechanism to handle the etc. Unchecked exceptions are not
checked at compile-time, but they are
runtime errors so that the normal flow of
checked at runtime.
the application can be maintained.
iii. Error
Exception Handling is a mechanism to handle Error is irrecoverable. Some example
runtime errors such as ClassNotFoundException, of errors are OutOfMemoryError,
IOException, SQLException, RemoteException, VirtualMachineError, AssertionError
etc. etc.
The core advantage of exception handling is to Java Exception Keywords
maintain the normal flow of the application. An
exception normally disrupts the normal flow of i. try
the application; that is why we need to handle The "try" keyword is used to specify a
exceptions. Let's consider a scenario: block where we should place an
exception code. It means we can't use
statement 1; try block alone. The try block must be
statement 2; followed by either catch or finally.

statement 3;
ii. catch
The "catch" block is used to handle the
exception. It must be preceded by try
block which means we can't use catch
block alone. It can be followed by
finally block later.

iii. finally
The "finally" block is used to execute
the necessary code of the program. It is
executed whether an exception is
handled or not.

III. OBJECT ORIENTED


PROGRAMMING

A. CLASSES & OBJECTS What is a class in Java?

What is an object in Java? A class is a group of objects which have common


An entity that has state and behavior is
properties. It is a template or blueprint from which
known as an object e.g., chair, bike,
marker, pen, table, car, etc. It can be objects are created. It is a logical entity. It can't be
physical or logical (tangible and physical.
intangible). The example of an intangible
object is the banking system. A class in Java can contain:

An object has three characteristics: o Fields


o State: represents the data (value) of
o Methods
an object.
o Constructors
o Behavior: represents the behavior o Blocks
(functionality) of an object such as
deposit, withdraw, etc. o Nested class and interface

o Identity: An object identity is typically


implemented via a unique ID. The
value of the ID is not visible to the
external user. However, it is used
internally by the JVM to identify each
object uniquely.

For Example, Pen is an object. Its name is


Reynolds; color is white, known as its state. It is
used to write, so writing is its behavior.
//Java Program to illustrate how to define a class TestStudent3 {
class and fields
public static void main(String args[]){
//Defining a Student class.
//Creating objects
class Student {
Student s1=new Student();
//defining fields
Student s2=new Student();
int id;
//Initializing objects
//field or data member or instance variable
s1.id=101;
String name;
s1.name="Sonoo";
//creating main method inside the Student class
s2.id=102;
public static void main (String args [ ]) {
s2.name="Amit";
//Creating an object or instance
//Printing data
Student s1=new Student ( );
System.out.println(s1.id + " " + s1.name);
//creating an object of Student
System.out.println(s2.id + " " + s2.name);
//Printing values of the object
}
System.out.println(s1.id);
}
//accessing member through reference
ii. By method
//variable
class Student{
System.out.println(s1.name);
int rollno;
}
String name;
}
void insertRecord(int r, String n){
Three Ways to initialize object
rollno=r;
There are 3 ways to initialize object in Java.
name=n;
i. By reference variable
}
class Student {
void displayInformation(){
int id;
System.out.println(rollno+" "+name);
String name;
}
}
class TestStudent4{ id=i;

public static void main(String args[]){ name=n;

Student s1=new Student(); salary=s;

Student s2=new Student(); }

s1.insertRecord(111,"Karan"); void display(){

s2.insertRecord(222,"Aryan"); System.out.println(id+" "+name+"


"+salary);
s1.displayInformation();
}
s2.displayInformation();
}
}
public class TestEmployee {
}
public static void main(String[] args) {

Employee e1=new Employee();

Employee e2=new Employee();

Employee e3=new Employee();

e1.insert(101,"ajeet",45000);

e2.insert(102,"irfan",25000);
As you can see in the above figure, object gets the
e3.insert(103,"nakul",55000);
memory in heap memory area. The reference
variable refers to the object allocated in the heap e1.display();
memory area. Here, s1 and s2 both are reference e2.display();
variables that refer to the objects allocated in
e3.display();
memory.
}

}
iii. By constructor

class Employee{

int id; B. CONSTRUCTOR


In Java, a constructor is a block of codes
String name;
similar to the method. It is called when an
float salary; instance of the class is created.

void insert(int i, String n, float s) {


At the time of calling constructor, memory //Java Program to create and call a default
for the object is allocated in the memory. constructor
It is a special type of method which is used
class Bike1{
to initialize the object.
Every time an object is created using the //creating a default constructor

new() keyword, at least one constructor is Bike1(){System.out.println("Bike is created");}


called.
//main method
It calls a default constructor if there is no
constructor available in the class. In such public static void main (String args [ ]){
case, Java compiler provides a default
//calling a default constructor
constructor by default.
Bike1 b=new Bike1();

There are two rules defined for the }


constructor:
}
i. Constructor name must be the same
as its class name
ii. A Constructor must have no
explicit return type
iii. A Java constructor cannot be
abstract, static, final, and
synchronized
The default constructor is used to provide the
default values to the object like 0, null, etc.,
There are two types of constructors in Java: depending on the type.

ii. Parametrized constructor


A constructor which has a specific
number of parameters is called a
parameterized constructor.
The parameterized constructor is used
to provide different values to distinct
objects. However, you can provide the
same values also.

i. Default constructor //Java Program to demonstrate the use of the


A constructor is called "Default
//parameterized constructor.
Constructor" when it doesn't have any
parameter. class Student4{
int id; //Java program to overload constructors

String name; class Student5{

//creating a parameterized constructor int id;

Student4(int i,String n){ String name;

id = i; int age;

name = n; //creating two arg constructor

} Student5(int i,String n){

//method to display the values id = i;

void display(){ name = n;

System.out.println(id+" "+name); }

} //creating three arg constructor

public static void main(String args[]){ Student5(int i,String n,int a){

//creating objects and passing values id = i;

Student4 s1 = new Student4(111,"Karan"); name = n;

Student4 s2 = new Student4(222,"Aryan"); age=a;

//calling method to display the values of }

//object void display(){

s1.display(); System.out.println(id+" "+name+" "+age);

s2.display(); }

} public static void main(String args[]){

} Student5 s1 = new Student5(111,"Karan");

Constructor Overloading Student5 s2 = new Student5(222,"Aryan",25);

Constructor overloading in Java is a technique of s1.display();


having more than one constructor with different
s2.display();
parameter lists. They are arranged in a way that
each constructor performs a different task. They }

are differentiated by the compiler by the number }


of parameters in the list and their types.
Inheritance represents the IS-A
Java Java Method
Constructor relationship which is also known as a
parent-child relationship.
A constructor is A method is used to
used to initialize expose the behavior of Why use inheritance in java?
the state of an an object.
i. For Method Overriding (so runtime
object.
polymorphism can be achieved).
A constructor A method must have a
ii. For Code Reusability.
must not have a return type.
return type. Terms used in Inheritance

The constructor is The method is invoked o Class: A class is a group of objects which
invoked implicitly. explicitly.
have common properties. It is a template
The Java compiler The method is not or blueprint from which objects are
provides a default provided by the created.
constructor if you compiler in any case.
o Sub Class/Child Class: Subclass is a class
don't have any
constructor in a which inherits the other class. It is also
class. called a derived class, extended class, or

The constructor The method name may child class.


name must be or may not be same as o Super Class/Parent Class: Superclass is
same as the class the class name. the class from where a subclass inherits the
name.
features. It is also called a base class or a
parent class.
o Reusability: As the name specifies,
reusability is a mechanism which
C. INHERITANCE
facilitates you to reuse the fields and
Inheritance in Java is a mechanism in
methods of the existing class when you
which one object acquires all the
create a new class. You can use the same
properties and behaviors of a parent object.
fields and methods already defined in the
It is an important part of OOPs (Object
previous class.
Oriented programming system).

The idea behind inheritance in Java is that class Employee{


you can create new classes that are built float salary=40000;
upon existing classes. When you inherit
}
from an existing class, you can reuse
methods and fields of the parent class. class Programmer extends Employee{
Moreover, you can add new methods and
int bonus=10000;
fields in your current class also.
public static void main(String args []){ Types of inheritance in java

Programmer p=new Programmer(); On the basis of class, there can be three types of
inheritance in java: single, multilevel and
System.out.println("Programmer salary
hierarchical.
is:"+p.salary);

System.out.println("Bonus of Programmer

is:"+p.bonus);

In the above example, Programmer object can


access the field of own class as well as of
1) Single Inheritance
Employee class i.e. code reusability.
When a class inherits another class, it is
known as a single inheritance. In the
example given below, Dog class inherits
the Animal class, so there is the single
inheritance.

class Animal{
void eat(){
System.out.println("eating...");
}
}
class Dog extends Animal{
void bark(){
System.out.println("barking...");
}
}
class TestInheritance{
public static void main(String args[]){
As displayed in the above figure, Programmer is
Dog d=new Dog();
the subclass and Employee is the superclass. The
d.bark();
relationship between the two classes is
d.eat();
Programmer IS-A Employee. It means that
}
Programmer is a type of Employee.
}
2) Multilevel Inheritance Dog and Cat classes inherits the Animal
When there is a chain of inheritance, it is class, so there is hierarchical inheritance.
known as multilevel inheritance. As you
can see in the example given below, class Animal{
BabyDog class inherits the Dog class void eat(){
which again inherits the Animal class, so System.out.println("eating...");
there is a multilevel inheritance. }
}
class Animal{ class Dog extends Animal{
void eat(){ void bark(){
System.out.println("eating..."); System.out.println("barking...");
} }
} }
class Dog extends Animal{ class Cat extends Animal{
void bark(){ void meow(){
System.out.println("barking..."); System.out.println("meowing...");
} }
} }
class BabyDog extends Dog{ class TestInheritance3{
void weep(){ public static void main(String args[]){
System.out.println("weeping..."); Cat c=new Cat();
} c.meow();
} c.eat();
class TestInheritance2{ }
public static void main(String args[]){ }
BabyDog d=new BabyDog();
d.weep();
d.bark(); D. POLYMORPHISM
d.eat(); There are two types of Polymorphism:
} i. Runtime Polymorphism
} Example: Method Overriding,
Upcasting
3) Hierarchical Inheritance Method Overriding
When two or more classes inherits a single If subclass (child class) has the same
class, it is known as hierarchical method as declared in the parent class,
inheritance. In the example given below, it is known as method overriding in
Java.
In other words, If a subclass provides ii. Compile time Polymorphism
the specific implementation of the Example: Method Overloading,
method that has been declared by one Constructor Overloading
of its parent class, it is known as
method overriding. Method Overloading
If a class has multiple methods having
//Java Program to illustrate the use of Java Method
same name but different in parameters,
//Overriding it is known as Method Overloading.

//Creating a parent class. If we have to perform only one


operation, having same name of the
class Vehicle {
methods increases the readability of
//defining a method the program.

void run ( ){ class Adder{

System.out.println ("Vehicle is running");

} static int add(int a, int b){

} return a+b;

//Creating a child class }

class Bike2 extends Vehicle{ static double add(double a, double b){

//defining the same method as in the parent class return a+b;

void run(){ }

System.out.println("Bike is running safely"); }

public static void main(String args[]){ class TestOverloading2{

Bike2 obj = new Bike2(); public static void main(String[] args){

//creating object System.out.println(Adder.add(11,11));

obj.run(); System.out.println(Adder.add(12.3,12.6));

//calling method }

} }

}
Constructor Overloading System.out.println("running safely");
Constructor overloading in Java is a
}
technique of having more than one
constructor with different parameter public static void main(String args[]){

lists. They are arranged in a way that Bike obj = new Honda4();
each constructor performs a different
obj.run();
task. They are differentiated by the
compiler by the number of parameters }
in the list and their types.
}

E. ABSTRACT CLASS F. INTERFACE


Abstraction is a process of hiding the An interface in Java is a blueprint of a
implementation details and showing only class. It has static constants and abstract
functionality to the user. methods.
A class which is declared as abstract is The interface in Java is a mechanism to
known as an abstract class. It can have achieve abstraction. There can be only
abstract and non-abstract methods. It needs abstract methods in the Java interface, not
to be extended and its method method body. It is used to achieve
implemented. It cannot be instantiated. abstraction and multiple inheritance in
o An abstract class must be declared with an Java.
abstract keyword. In other words, you can say that interfaces
o It can have abstract and non-abstract can have abstract methods and variables. It
methods. cannot have a method body.
o It cannot be instantiated. It cannot be instantiated just like the
o It can have constructors and static methods abstract class.
also.
o It can have final methods which will force There are mainly three reasons to use
the subclass not to change the body of the interface. They are given below:
method. o It is used to achieve abstraction.
o By interface, we can support the
abstract class Bike{
functionality of multiple
abstract void run();
inheritance.
} o It can be used to achieve loose
coupling.
class Honda4 extends Bike{

void run(){
interface Printable{
Abstract class Interface
void print();
1) Abstract class Interface can have only
} can have abstract abstract methods.
and non- Since Java 8, it can
abstract methods. have default and
static methods also.
interface Showable extends Printable{
2) Abstract Interface supports
void show();
class doesn't multiple inheritance.
} support multiple
inheritance.

3) Abstract class can Interface has only


class TestInterface4 implements Showable{ have final, non- static and final
final, static and variables.
public void print(){ non-static
variables.
System.out.println("Hello");
4) Abstract class can Interface can't
} provide the provide the
implementation of implementation of
public void show(){
interface. abstract class.
System.out.println("Welcome");
5) The abstract The interface
} keyword is used to keyword is used to
declare abstract declare interface.
public static void main(String args[]){ class.

TestInterface4 obj = new TestInterface4(); 6) An abstract An interface can


class can extend extend another Java
obj.print(); another Java class interface only.
and implement
obj.show(); multiple Java
interfaces.
}
7)An abstract An interface can be
}
class can be implemented using
extended using keyword "implements".
keyword "extends".

8) A Java abstract Members of a Java


class can have class interface are public by
members like default.
private, protected,
etc.
IV. CONCLUSION ACKNOWLEDGEMENT
In this training, I have completed all the topics I am grateful to the kind of UIET Kurukshetra
required for Core Java. Management to provide me permission to do
Industrial Training. I would like to thank Dr.
At first, I learnt about various data types &
Nikhil Marriwala sir for his motivation to guide
Operators.
every students to learn these useful skills.
After that, I learnt about various Iterators, like for-
I would also like to express my gratitude towards
loop, while loop, do-while loop, etc.
Internshala Online Trainings for providing me an
Apart from this, I have learnt about Methods, its Online platform to learn these complex things in
Overriding & Overloading. simpler terms.

I also learnt about Object Oriented Programming At last, I end up thanking everyone who helped in
in Java, in which I learnt Interface, Classes & doing this Industrial Training.
Objects, Polymorphism, Inheritance & Abstract
Class.

I have also developed an assignment & a game


based on JAVAFX.

You might also like