Sie sind auf Seite 1von 15

PRESENTATION ON CORE-JAVA

SUBMITTED BY-
RASHI SINGH
BTECH (CSE)
1636310081
JAVA
• Java is one of the most popular and widely used
programming language and platform. A platform
is an environment that helps to develop and run
programs written in any programming language.
• Some Features are-:
1. Java is platform independent language
2. Java is object-oriented language
3. Java is multithreaded language
4. Java is used to make applets
Data types in Java

• Java has two categories of data:


1) Primitive data (e.g., number, character)
2)Object data (programmer created types)

• Primitive data are only single values; they have no


special capabilities. There are 8 primitive data
types : boolean, byte, short , int, char, short, long,
float, double.
LOOPS IN JAVA
• Looping in programming languages is a
feature which facilitates the execution of a set
of instructions/functions repeatedly while
some condition evaluates to true.
• Types of loops:
1)while loop
2)for loop
3)do-while loop
Decision Making in Java

• A programming language uses control statements


to control the flow of execution of program based
on certain conditions.
• Java’s Selection statements:
• if
• if-else
• nested-if
• if-else-if
• switch-case
• jump– break, continue, return
PACKAGES IN JAVA
• Packages in java is a mechanism to encapsulate a group
of classes, subpackages and interfaces.

• Packages are used for preventing naming conflicts.

• There are two types of packages-:


1)BUILT IN PACKAGES:These consist of large number of
classes, which are predefined.
a)java.lang: Contains languages support classes

b)java.io:Contains classes for supporting


input/output operation

c)java.util : Contains utility classes for


implementing data structures
User-Defined Packages
• These packages are defined by user
• Package myPackage;
{
public void getNames(String s)
{
System.out.println(s);
}
}
Object Oriented programming
concepts
1) Object-Oriented Programming or OOPs refers to
languages that uses objects in programming.
• OOPs Concepts:
1) Polymorphism
2) Inheritance
3) Encapsulation
4) Abstraction
5) Class
6) Object
7) Message passing
8) Method
POLYMORPHISM
• Polymorphism refers to the ability of OOPs
programming languages to differentiate
between entities with the same name
efficiently.
• This is done by Java with the help of the
signature and declaration of these entities.
INHERITANCE
• It is the mechanism in java by which one class is
allow to inherit the features(fields and methods)
of another class.
• Super Class: The class whose features are
inherited is known as superclass(or a base class
or a parent class).
• Sub Class: The class that inherits the other class is
known as subclass(or a derived class, extended
class, or child class).
• The keyword used for inheritance is extends.
ENCAPSULATION
• Encapsulation is defined as the wrapping up
of data under a single unit. It is the
mechanism that binds together code and the
data it manipulates.
• As in encapsulation, the data in a class is
hidden from other classes, so it is also known
as data-hiding.
ABSTRACTION
• Data Abstraction is the property by virtue of
which only the essential details are displayed
to the user. The trivial or the non-essentials
units are not displayed to the user.
• Ex: A car is viewed as a car rather than its
individual components.
• In java, abstraction is achieved
INTERFACES and ABSTRACT CLASSES. We can
achieve 100% abstraction using interfaces.
Strings in JAVA
• Strings are defined as an array of characters.
• There are two ways to create string in Java:
• Using string literal
String s = “Hello world”;
• Using new keyword
String s = new String (“Hello world”);
• In java, objects of String are immutable which means a
constant and cannot be changed once created.
• Whenever a String Object is created, two objects will be created-
one in the Heap Area and one in the String constant pool and the
String object reference always points to heap area object.
ARRAYS IN JAVA
• An array is a group of like-typed variables that
are referred to by a common name.
• Java array can be also be used as a static field,
a local variable or a method parameter.
• Array can contains primitives data types as
well as objects of a class depending on the
definition of array.
• One-dimensional array syntax :
int[] intArray = new int[20];

Das könnte Ihnen auch gefallen