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

Lecture 01

The document introduces Java programming and object-oriented concepts. It covers the history and features of Java, how Java applications and applets differ, and the Java development kit. It also provides an example of a simple Java program.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
17 views18 pages

Lecture 01

The document introduces Java programming and object-oriented concepts. It covers the history and features of Java, how Java applications and applets differ, and the Java development kit. It also provides an example of a simple Java program.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 18

Lecture 1

Introduction to Object-Oriented
Programming Using Java
Agenda
1- Java Introduction
2- Why Learn Java?
3- Feature of Java
4- Java Development kit(JDK)
5- How does Java Work
• Java was created by James Gosling in 1995 for
Sun Microsystems.
• Java is a Platform Independent Programming
Language that follows the logic of “Write
once, Run anywhere” (WORA).
Java Follow the Concurrent Approach
Note

Concurrency is the ability to run several programs or


several parts of a program in parallel. If a time
consuming task can be performed asynchronously or in
parallel, this improve the throughput and the
interactivity of the program.
Sun white paper defines Java as:

• Simple and Powerful


• Safe
• Object Oriented
• Robust
• Architecture Neutral and Portable
• Interpreted and High Performance
• Threaded
• Dynamic
Java is Compiled and Interpreted

Hardware and
Programmer
Operating System

Source Code Byte Code


Text Interprete
Compiler
Editor r
.java file .class file
Notepad, javac java
emacs,vi appletviewer
netscape
Total Platform Independence

JAVA COMPILER
(translator)

JAVA BYTE CODE


(same for all platforms)

JAVA INTERPRETER
(one for each different system)

Windows 95 Macintosh Solaris Windows NT


Platform Independent
Java is a platform independent programming
language, Because when you install jdk software on
your system then automatically JVM are installed on
your system. For every operating system separate
JVM is available which is capable to read
the .class file or byte code. When we compile your
Java code then .class file is generated by javac
compiler these codes are readable by JVM and
every operating system have its own JVM so JVM is
platform dependent but due to JVM java language is
become platform independent.
Overlap of C, C++, and Java

C++

Java
C
Java better than C++ ?

• No Typedefs, Defines, or Preprocessor


• No Global Variables
• No Goto statements
• No Pointers

?
• No Unsafe Structures
• No Multiple Inheritance
• No Operator Overloading
• No Automatic Coercions
• No Fragile Data Types
Java Applications
• We can develop two types of Java programs:
– Stand-alone applications
– Web applications (applets)

Applications v/s Applets

• Different ways to run a Java executable are:


Application- A stand-alone program that can be invoked from
command line . A program that has a “main” method

Applet- A program embedded in a web page , to be run when


the page is browsed . A program that contains no “main”
method
Java Development Kit

• javac - The Java Compiler


• java - The Java Interpreter
• jdb- The Java Debugger
• appletviewer -Tool to run the applets
• javap - to print the Java bytecode
• javaprof - Java profiler
• javadoc - documentation generator
• javah - creates C header files
Installation and Setup
of Eclipse 2018-12

1- Java Development Kit(JDK)


2- Eclipse IDE(Integrated Development
Environment)
Let us Try Out

Building your first Java Program


Example…
1- Create your Java Project
2- Create your Package (folder in Java)
3- Select your location to track your work
4- Create your Class
Example of First Java Program

package firstprogram;

public class HelloWorld


{
public static void main(String[] args)
{
System.out.println(“Hello World");

}
Example…
package fisrtprogram;

public class FirstProgram


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

System.out.println(« Welcome to Java Programming");

int x =10;
int y=20;
int result=x+y;

System.out.println(result);
System.out.println("result="+result);
}
}

You might also like