0% found this document useful (0 votes)
14 views25 pages

Understanding Programming Languages and Java

The document discusses different types of programming languages and concepts related to Java programming. It covers topics like high level languages, object oriented principles, Java features and history, Java architecture including JDK, JRE and JVM, Java tokens and statements.

Uploaded by

AbdulRaheem
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)
14 views25 pages

Understanding Programming Languages and Java

The document discusses different types of programming languages and concepts related to Java programming. It covers topics like high level languages, object oriented principles, Java features and history, Java architecture including JDK, JRE and JVM, Java tokens and statements.

Uploaded by

AbdulRaheem
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

By Raheem

Introduction
Program : is Nothing but a group of

statements to perform a particular task. For writing the program , corresponding language is required. Languages are 3 types: [Link] languages [Link] languages [Link] languages

Introduction
Low Level Very difficult to

Middle Level

High level

reading,writing,debuggi ng etc(ex:Binary language) Difficult to reading,writing,debuggi ng etc(ex:Assembly language) Easy to reading,writing,debuggi ng(ex:c,c++,java)

High Level Languages


Structured programming languages:

->These are composed of Simple,hierarchical flow structures. These are sequence, selection, and repetition. ->The above steps are difficult to follow and to maintain.(ex:C) Object Based Languages ->These will support the object oriented features Abstraction and encapsulation.(not polymorphism and Inheritence are not supported)(ex:VB ,javascript) Object Oriented Languages -> These will support the object oriented features abstraction,encapsulation,inheritence and polymorphism. (java,smalltalk,c++)

Object Oriented Principles


It deals with objects.

Objects are 2 two kinds. Real Life Objects : Which are physically existing Software objects: Exists only within the memory. These are created for the real life applications. If an entity can satisfy 3 conditions , then it is called as an object. -> State: It is nothing but part of the object . It is recognized as a variable in the programming language. It is not constant.

Object Oriented Principles


->Behavior : These are the representation of the actions. If we want to get an action , it depends on the state of the object . If state is modified then automatically behavior is also modified. ->Identity : It is only for identification.

o Objects are independent.

Object Oriented Principles(OOPS)


Advantages of oops:

->Objects are independent. -> Modifications can be done easily. ->Code reusability. o 4 principles I. Abstraction II. Encapsulation III. Inheritance IV. Polymorphism Any language will supports above 4 principles , that language called as Object Oriented Language.

Java Introduction
Java is an OOL. Java is a fully OOL. java is not pure OOL by default . By

adding wrapper classes , it is becoming as a pure OOL. Java is strictly typed language. Java programs are one time creation and [Link] times execution(WORE/WORA)

Features of Java
Simple language OOL Platform Independent Robust Secure

Multithreaded
Architectural Neutral Distributed language

Dynamic language

History of Java
James Gosling is called the father of java Developed by SUN Microsystems(green team) First name is OAK Logo coffee bean Moscot Duke First time tested on Solaris SPARC First browser supported is Netscape Navigator Java has it own browser called Hot Java It is an open source software

Year

Version

Code Name -

P&C 8P,212C 23P,504C

New Features All are new Inner classes,Swing are introduced and Improved the AWT Rebirth of java. JFC , UI , Collections

1995 JDK 1.0 1997 JDK 1.1

1999 Jdk1.2 (j2sdk1.2)

palygrou 59P,1520C nd

2000 J2sdk1.3
2002 J2sdk1.4 2004 J2sdk1.5

kestral
Merlin Tiger

76P,1842C

HotSpot JVM

135P,2991C Assertions , logging facility in [Link] 165P,3000C Revolutionary one . (more ) Autoboxing , templates etc are introduced.

J2sdk1.6

Mustang

Introduction
Java Categories Standard Edition

->Small Applications ->Middle Applications Enterprise Edition ->Enterprise Applications Micro Edition ->Mobile Applications

Architecture
JDK-Java Development Kit
JRE-Java Runtime Environment JVM-Java Virtual Machine JDK Tools=JRE +JVM JRE = RunTime Libraries +JVM

JDK Tools
When Java is installed , the following folders are created. bin , Demo , include , jre and lib Bin-contains executable files Some JDK Tools are javac , javap , java , jdb , javah , jarsigner , appletviewer , keytool , jar , javadoc Javac-It is used to compile the java programs Javac [Link] ->During compilation , to see what is happening then use verbose ex: javac verbose [Link] ->To compile more file javac @abc ->It will translate the java code into byte code .java -> .class

JDK Tools
Java : It will convert the .class file into .exe

->It is also called as java executor ex: java filename Javap : It is also called as java profiler Used to find out the details of the class ex : javap filename javap [Link] Javadoc : It is help file javap [Link]

JVM
It is a software used to convert the byte code into

machine code. It is specific to operating system. Each and every OS , separate JVM is available. ->Byte code and Binary code both are not same. ->Binary code means executable code or machine code. ->Byte code is an intermediate code . It is executed directly . It is executed by JVM.

Java Tokens
Token is a smallest individual unit.
Every statement is a combination of tokens. Tokens are

->Whitespaces (blank /spacebar/tab) ->Identifiers(variables) Used to identify the memory location ->Comments These are not recognized by compiler. Provides description of the program.

Java Tokens
3 types i)Single line c style (/*-----*/) c ++ style (//) ii)Multiline/paragraph (/* -------------*/) iii)HTML/Document (/**--------------*/)

Java Tokens
Separator : Used to separate the statements

[] array initialization {} block statements/ array initialization () function declaration , - separation of variables ; - end of the statement Literals _______________________________ Integer float character booolean String

Java Tokens
Operators : Used to perform an opearation

Unary one operand ( +x , -x) Binary Two operands (x+y,x-y) Ternary 3 operands (a>b ? T : F) Arithmetic : + , - , / , % Logical : boolean(T/F) logical AND - & logical OR - | logical not - ! Conditional AND - && Conditional OR - ||

Java Tokens
Negation - ~ Assignment i = i + 2

i+ =2 Comparison - == Conditional -> new : memory allocation operator ->(type) : casting -> instance of - used to findout the corresponding object is belongs to the class or not

Java Tokens
Truth table for logical operators
x T T y T F !x F F X&y X&& y T F X|y X || y T T X xor y F T

F
F

T
F

T
T

F
T

T
F

T
F

Java Tokens
& - Event though first condition is false, it will

check for the second. && - If first condition is true then only control goes to next condition otherwise second condition not checked Keywords : All are predefined and should be use them as a variable. Statements : Tokens are grouped together to form a statement.

Java Tokens
Statement Expression ->Assignment ->Memory allocation ->Method call ->Preincrement/postIncrement ->predecrement/postdecrement Selection ->Conditional - if else , switch case ->Iterative - do while , while , for ->Transfer/jump - break , continue , return

Java Tokens
Syncronized Safeguard statements -contains try-catch

Common questions

Powered by AI

Java tokens represent the smallest individual units in a program and include whitespaces, identifiers, comments, literals, separators, and operators . They contribute to syntax and structuring by defining the fundamental elements used in program building. For instance, the use of operators facilitates various operations, while separators help in organizing code blocks, and identifiers label memory locations .

Inheritance allows new classes to inherit properties and behavior from existing classes, promoting code reuse and hierarchical class structuring, which simplifies maintenance . Polymorphism enables objects to be treated as instances of their parent class, allowing for flexible code that can handle multiple object types through a single interface, enhancing the ability to build scalable and adaptable systems .

Upon installing Java, key architectural components such as JDK, JRE, and JVM are established. JDK (Java Development Kit) includes JRE (Java Runtime Environment) and development tools like javac for compilation and javadoc for documentation . JRE provides the Java libraries and JVM needed for running Java applications. JVM is crucial for interpreting byte code into machine-specific code, ensuring cross-platform compatibility . These components collectively form the foundation for development, testing, and execution of Java applications, underscoring Java's robustness and portability .

Structured programming languages are based on hierarchical flow structures such as sequence, selection, and repetition, which can be difficult to maintain . In contrast, object-oriented languages include principles like abstraction, encapsulation, inheritance, and polymorphism, allowing objects to be independent and modifications to be made easily. This also leads to code reusability .

Java's security features, including its byte code verification and built-in security packages, protect against unauthorized operations, essential for applications like web services and mobile apps that handle sensitive data . Its multithreading capability allows concurrent execution of tasks, efficiently utilizing CPU resources and enhancing performance in complex, compute-intensive applications. Together, these features address modern demands for secure, responsive, and efficient software systems .

James Gosling, known as the father of Java, played a pivotal role in its development under SUN Microsystems. Java was initially named OAK and first tested on Solaris SPARC, showcasing its cross-platform capabilities . The first browser to support Java was Netscape Navigator, which was significant because it allowed Java applets to run on web pages, expanding Java's applicability and user base .

Java is considered a fully object-oriented language because it supports all object-oriented principles such as abstraction, encapsulation, inheritance, and polymorphism . However, it is not 'pure' by default because it includes primitive data types, but by using wrapper classes, it can achieve pureness by treating everything as an object .

Java's platform independence is achieved through the use of byte code executed by the Java Virtual Machine (JVM), which is available on multiple operating systems . Architecture neutrality ensures that compiled code is consistent across different hardware architectures. This means developers can write Java programs once and run them anywhere (WORA), significantly broadening its adoption across diverse systems and devices .

Autoboxing, introduced in J2SDK 1.5, allows for automatic conversion between Java's primitive data types and their corresponding wrapper classes . This feature simplifies the code by reducing the manual creation of objects for primitive data, improving integration with data structures and APIs that require objects. Autoboxing thus bridges the gap between object-oriented Java and its primitive data types, aligning with Java's push towards a more consistent object-oriented paradigm .

The HotSpot JVM, introduced with J2SDK 1.3, improved Java's performance by optimizing the execution of byte code using adaptive optimization techniques . HotSpot uses just-in-time compilation to convert byte code into machine code, which increases execution speed. Additionally, it monitors code execution patterns to optimize frequently used methods, thus enhancing runtime efficiency .

You might also like