0% found this document useful (0 votes)
31 views18 pages

Uttaranchal University: Topic:Summer Internship Introduction To Java

The document provides an introduction to Java programming language. It discusses the history, syntax, features, data types, object-oriented concepts like classes, objects, inheritance, abstraction, polymorphism and gives an example of how a Java program is executed. It also includes an index and covers topics like introduction to Java, syntax, features, data types, object-oriented programming language, application of Java and includes a sample project flowchart.

Uploaded by

Rakhi Bisht
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)
31 views18 pages

Uttaranchal University: Topic:Summer Internship Introduction To Java

The document provides an introduction to Java programming language. It discusses the history, syntax, features, data types, object-oriented concepts like classes, objects, inheritance, abstraction, polymorphism and gives an example of how a Java program is executed. It also includes an index and covers topics like introduction to Java, syntax, features, data types, object-oriented programming language, application of Java and includes a sample project flowchart.

Uploaded by

Rakhi Bisht
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/ 18

UTTARANCHAL UNIVERSITY

DEPARTMENT OF COMPUTER
SCIENCE
TOPIC :SUMMER INTERNSHIP
INTRODUCTION TO JAVA

PRESENTED BY : SUBMITTED TO:


NAME: RAKHI Mr. Anurag Kumar
CLASS: CSE 4
YEAR : 2 YEAR
ROLL NO. : 33/22210101343
INDEX

• Introduction to java
• Syntax
• Features of java
• Types of data
• Object oriented programing language
• Application of java
• Project(flow chart)
• Certificate of the course
Execution of a java program:
INTRODUCTION TO JAVA
Java is high- level ,object -oriented programing language
initially developed by sun-microsystems. It was designed to
be a platform independence , meaning that java can be run
in any device or operating system like windows, mac, linux,
etc .. this platform independence is achieved through ”
write once run anywhere” approach ,in java source code is
compiled into bytecode and the it is executed by the JVM
(java virtual machine).
HISTORY:
Java was developed by James Gosling and his team at Sun
Microsystems in the mid-1990s. The first version, Java 1.0, was
released in 1996.
Over the years, Java has evolved with the introduction of new
versions and updates. Major releases include Java 2, Java SE
(Standard Edition), Java EE (Enterprise Edition), and Java ME
(Micro Edition). These editions cater to different application
development needs. Java SE is widely used for general purpose
programming.
• public class Main {
SYANTAX • public static void main(String[] args)
• { System.out.println("Hello World"); } }

NOTE
Every line of code that runs in Java must be inside a class
Any code inside the main() method will be executed.
Inside the main() method, we can use the println() method to print a line of text to the screen

each code statement must end with a semicolon (;).


the curly races {} marks the beginning and the end of a block of code.

System is a built-in Java class that contains useful members, such as out, which is
short for "output". The println() method, short for "print line", is used to print a
value to the screen (or a file).
FEATURES OF JAVA

•Simple: Java syntax is based on C++ (so easier for


programmers to learn it after C++).
•Java has removed many complicated and rarely-used
features, for example, explicit pointers, operator
overloading, etc.

•Platform independence: java is a open source which can be


available in any platform .java bytecode can be executed in
any platform with the appropriate JVM.

•Object-oriented : java follows the object-oriented features


like inheritance , abstraction, encapsulation ,polymorphism

•Robust and secure: java has a features like memory


management , strong type casting , exception handling to
ensure robust secure program
FEATURES OF JAVA

•Multithreading: java supports multithreading ,allowing multiple tasks to be executed concurrently

•Dynamic: java supports dynamic memory allocation and garbage collection , simplifying memory management

•High performance: Java is faster than other traditional interpreted programming languages because Java
bytecode is "close" to native code. It is still a little bit slower than a compiled language

•Distributed java has libraries for creating distributed application allowing components to communicate over a
network

•Portable: javas “write once run anywhere “ capability makes it highly portable
TYPES OF DATA
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:

1-PRIMITIVE 2-NON-PRIMITIVE

1- Boolean Data Type: The Boolean data type is used to store only two
possible values: true and false. This data type is used for simple flags that
track true/false conditions.

2- Byte Data Type: The byte data type is an example of primitive data
type. It is an 8-bit signed two's complement integer. Its value-range lies
between -128 to 127 (inclusive). Its default value is 0.The byte data type
is used to save memory in large arrays where the memory savings is most
required. It saves space because a byte is 4 times smaller than an integer.

3- Int Data Type: The int data type is a 32-bit signed two's complement
integer. Its value-range lies between - 2,147,483,648 (-2^31) to
2,147,483,647 (2^31 -1) (inclusive).. Its default value is 0.The int data type
is generally used as a default data type for integral values unless if there
is no problem about memory.
TYPES OF DATA
4-Long Data Type:
The long data type is a 64-bit two's complement integer. Its value-range lies between -9,223,372,036,854,775,808(-
2^63) to 9,223,372,036,854,775,807(2^63 )-Its default value is 0. The long data type is used when you need a range
of values more than those provided by int.

5-Float Data Type:


The float data type is a single-precision 32-bit.Its value range is unlimited. It is recommended to use a float (instead
of double) if you need to save memory in large arrays of floating point numbers. The float data type should never be
used for precise values, such as currency. Its default value is 0.0F.

6-Double Data Type:


The double data type is a double-precision 64-bit. Its value range is unlimited. The double data type is generally used
for decimal values just like float. The double data type also should never be used for precise values, such as currency.
Its default value is 0.0d.

7-Char Data Type:


The char data type is a single 16-bit Unicode character. Its value-range lies between '\u0000' (or 0) to '\uffff' (or
65,535 inclusive).The char data type is used to store characters.

8-Short Data Type: The short data type is a 16-bit signed two's complement integer. Its value-range lies between -
32,768 to 32,767 (inclusive). Its minimum value is -32,768 and maximum value is 32,767. Its default value is 0.
The short data type can also be used to save memory just like byte data type. A short data type is 2 times smaller
OBJECT ORIENTED
PROGRAMMING LANGUAGE

•OOPs refers to languages that use objects in


programming, they use objects as a primary source to
implement what is to happen in the code.
•Objects are seen by the viewer or user, performing
tasks assigned by you.
• Object-oriented programming aims to implement
real-world entities like inheritance, hiding,
polymorphism etc. in programming.
• The main aim of OOP is to bind together the data and
the functions that operate on them so that no other
part of the code can access this data except that
function.
CLASS: A class is a user-defined blueprint or prototype from which objects are created. It represents the set of
properties or methods that are common to all objects of one type. Using classes, you can create multiple
objects with the same behavior instead of writing their code multiple times.

OBJECT: An object is a basic unit of Object-Oriented Programming that represents real-life entities. A typical Java
program creates many objects, which as you know, interact by invoking methods.

Abstraction: Abstraction in Java refers to the concept of hiding complex details and only showing essential
information. It helps in simplifying code and making it more manageable.
abstraction is achieved by interface and abstract classes. We can achieve 100% abstraction using
interfaces.
The abstract method contains only method declaration but not implementation.

Demonstration of Abstract class :

//abstract class
abstract class GFG{
//abstract methods declaration
abstract void add();
abstract void mul();
abstract void div();
}
INHERITANCE:
•Inheritance in Java allows a class to inherit properties and
behaviors from another class. It promotes code reuse .To
implement inheritance, we use the keyword "extends" to create a
subclass (child class) that inherits from a superclass (parent class).
•The subclass inherits all the non-private fields and methods of the
superclass and can also have its own additional fields and methods
•It also allows for method overriding, where the subclass can
provide its own implementation of a method inherited from the
superclass.
• This helps in organizing and structuring code, making it more
maintainable and scalable.
•example: 1.class Animal{
2.void eat(){
3.System.out.println("eating...");
4.}
5.}
6.class Dog extends Animal{
7.void bark(){System.out.println ("barking...");}
8.}
9.class TestInheritance{
10.public static void main(String args[]){
11.Dog d=new Dog();
12.d.bark();
POLYMORPHISM: Polymorphism in Java is a concept by which we can perform a single action in different ways.
Polymorphism is derived from 2 Greek words: poly and morphs. The word "poly" means many
and "morphs" means forms. So polymorphism means many forms.

SYNTAX:

1.class Bike{
2. void run(){System.out.println("running");}
3.}
4.class Splendor extends Bike{
5. void run()
{System.out.println("running safely with 60km");}
6.
7. public static void main(String args[]){
8. Bike b = new Splendor();//upcasting
9. b.run();
10. }
11.}
ENCAPSULATION: Encapsulation in Java is a mechanism that bundles data and methods together within a class, and
restricts direct access to the data from outside the class. It helps in achieving data hiding and
abstraction.
By declaring the instance variables of a class as private, we can control access to them. To access or
modify these variables, we use public getter and setter methods. This way, we can enforce validation
and ensure that the data is accessed and modified in a controlled manner.

Syntax: class Person {


private String name;
private int age;

public String getName() { return name; }

public void setName(String name) { this.name = name; }

public int getAge() { return age; }

public void setAge(int age) { this.age = age; }


}

public class Main {


public static void main(String[] args)
{
Person person = new Person();
person.setName("John");
person.setAge(30);

System.out.println("Name: " + person.getName());


System.out.println("Age: " + person.getAge());
}
APPLICATIONS OF JAVA:
1- MOBLIE APPLICATION
2- WEB BASED APPLICATION
3-GAMING APPLICATION
4-SCIENTIFIC APPLICATION
5-DESKTOP GUI APPLICATION
6-BUSINESS APPLICATION
PROJECT-ATM(Automated Teller Machine)
Flow Chart Of The ATM
1 Check the balance Outputs

2 Withdraw
CERTIFICATE OF THE COURSE
THANK YOU!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy