0% found this document useful (0 votes)
27 views

Java Intro

This document provides an introduction to the Java programming language. It discusses Java's history, development, and key concepts like object-oriented programming, classes, objects, inheritance, polymorphism, abstraction, and encapsulation. It also describes how to structure a basic Java program with packages, imports, interfaces, classes, and the main method. Finally, it outlines the steps to compile and run a Java program using the command line.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Java Intro

This document provides an introduction to the Java programming language. It discusses Java's history, development, and key concepts like object-oriented programming, classes, objects, inheritance, polymorphism, abstraction, and encapsulation. It also describes how to structure a basic Java program with packages, imports, interfaces, classes, and the main method. Finally, it outlines the steps to compile and run a Java program using the command line.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

Java

Programming language

Program

"Collection of steps"

Algorithm independent
MANUAL
Addition of 2 nos

step 1 : start
step 2 : take 2 values(a,b)
step 3 : add 2 values c=a+b
step 4 : print addition of 2 values( c)
step 5 : stop

a=10 b=20
c=10+20=30
addition of 2 values =30

** multiplication of 3 numbers

step 1 : start
step 2 : take 3 values(x,y,z)
step 3 : product of 3 values m=x*y*z
step 4 : print multiplication of 3 values( m)
step 5 : stop
compiler
2 ...
4....

interpreter

Program -> XXX -> system


english Translator binary

Compiler Translater of high level to machine level


interpreter

Introduction to Java

History
James Gosling in Sun Microsystems
"Oak" tree
1991
"java" Coffee plant in Indonasia

Web application
General application

1995
jdk1.0

jdk1.8
Java Development Kit
JRE
JVM
JSL ??
SOFTWARE
we can directly download from "Oracle corporation"

IDE
Integrated Dev Environment
netbeans
eclipse
syncjEdit
notepad++
OOP
Object Oriented Programming
CLASS
OBJECTS
INHERITANCE Reusability extends
Android
Polymorphism
single thing works differently
student
children
friend

poly many
morphism changing

abstraction
encapsulation
hiding
dynamic binding
message communication

Object Ex
student 1001 suman EEE 1 RECORD/OBJECT
1002 RAVI ECE
attendance
exam
results tasks
sports
employee
ration
uid

Structure of Java program


Skeleton

package statement optional


import statement essential
interface defintions optional
class definitions optinal
class <cname> Required
{
public static void main(String[ ] args) Required
{
statements
}
}

class
members
operations tasks
methods

package statement
Collection
JSL
packages + sub packages+classes +methods
io
util
lang
net
applet

Math
mathematical functions
abs
pow(10,3)
Math.sqrt(36)

import statement
java does not support
Pre Processor directives
not including header files
instead ,we use packages

#include<stdio.h>
#define max 300

import java.io.*;
import java.awt.*;

interface defintions
To Achieve Multiple inheritance in java
it is almost a class

public static void main(String args[])

public: to access by all


private protected

static : executing method without object

void : return nothing

String args[ ] Cmd Line args


class array

"123" "xyz" "3+55" "5.666" strings


123
abc 6.788 556
'A' '&' '2' '-' characters
Architectural Neutral??

how to write a java program?


2 ways to write a program
Editor(notepad) + cmd prompt
IDE(Eclipse)

compiling and executing Program using Command Prompt

Editor(notepad) + cmd prompt


-> open notepad
-> write the Source Code(program)
-> Save the file with Classname and followed by " . java"
Extension
Ex: Example . java
->To compile the program we need to open "Cmd" "start-> cmd"
-> set the path of the directory as
C:\JDK17\BIN
For compiling a java program we need to use
java compiler
"javac"
-> it wil give you list of errors,if any.Rectify the errors and compile
-> after successful compilation
EX:
c:\jdk17\bin> javac Example.java

Executing program
we use java Interpreter "java"
To Execute the program ,we need to use the Class with main( )

c:\jdk1.8\bin> java Example


JDK
parts
JSL
JRE
JVM
AGC

You might also like