SlideShare a Scribd company logo
1 of 6
Download to read offline
1. THE JAVA PROGRAMMING LANGUAGE
What is Java?
Java programming language is a high-level language that can be characterized by all of the
following buzzwords:
• Compiled and Interpreted

• Architecture neutral

• Distributed

• Object oriented

• Robust

• Secure

• Multithreaded

• Dynamic

• Extensible

• High performance

• Easy to learn

Java features elaborated:
1. Compiled and Interpreted
Usually a computer language is either compiled or interpreted. Java combines both these
features and thus there are two stages involved in a Java program. First, Java translates
the source code into bytecode instructions. Bytecodes are not machine instructions. So in
the next stage, the Java interpreter generates the machine code that can be directly
executed by the machine that is running the Java program. This interpretation is done by
the Java virtual machine.
2. Platform-independent and portable
Java programs can be easily moved from one computer system to another. If there are any
changes in the OS, processor, and other system resources, there is no need to change the
Java program. This portability is achieved in two ways: first Java generates the bytecode
instructions that can be run on any machine. Also, the size of the primitive data types are
machine independent. This portability is the reason behind the huge success of Java in the
networking domain, especially the Internet. We can download an applet from a remote
computer to our computer system and execute it locally.
3. Distributed
Java was designed with networking in mind. Java programs can share data across
networks. Java programs can open and access objects on network devices.
4. Object-oriented
Java is object oriented. No coding is permitted outside class definitions. An extensive
class library can be used by the programmer
5. Robust
Java is a robust language. All local variables must be initialized. There is strong typechecking. That is, all data must be declared explicitly. It has garbage-collection features
which means that memory management is no longer something the programmer needs to
Java - Chapter 1

Page 1 of 6
The Java Programming Language

be worried about. Java also does exception handling – serious errors are captured and the
risk of crashing the system is minimized.
6. Secure
Since Java has been designed for networked environments, security is an important
feature of this language. Java systems verify all memory accesses. The absence of
pointers in Java ensures that programs do not have access to all memory locations.
7. Multithreaded
Multithreading means handling many (multiple) tasks simultaneously. Java handles
multithreaded programs. It means that we need not wait for one task to be completed
before starting the next task. Such systems are very useful for graphical interactive
environments.
8. Dynamic and extensible
The linking of data and methods to where they are located, is done at run-time. New
classes can be loaded while a program is running. Linking is done on the fly. Even if
libraries are recompiled, there is no need to recompile code that uses classes in those
libraries. This differs from C++, which uses static binding.
By extensible we mean that Java programs can support functions written in other
languages such as C or C++. These functions are called native methods. Such functions
are linked dynamically at runtime.
9. High performance
Even though Java is interpreted (in the second stage), its speed is impressive compared to
other interpreted languages. This is due to the use of the intermediate bytecode. Also, the
multithreading feature further increases the speed of execution of Java programs.
10. Simple to learn
Java is a simple and small language. Many features of C / C++ have been removed from
Java. For example, pointers, preprocessor header files (e.g., #include <stdio.h>), goto
statement, operator overloading, multiple inheritance, etc have been eliminated from Java.

Differences between Java and C:
Although Java syntax is in many ways including operators and statements, there are many
significant differences in these languages.
No preprocessor
Java does not include a preprocessor(C and C++ both have the #include
preprocessor directive). Also #define, #ifdef are missing from Java.
No macro definitions
Java does not support macros (#define in C).
Page 2 of 6

Java - Chapter 1
The Java Programming Language

No global variables
There are no global variables in Java. Packages contain classes, classes contain fields
and methods, and methods contain local variables.
Well-defined primitive data types
All primitive data types in Java have well-defined sizes. In C, the size of short,
int, and long data types is platform-dependent. This hampers portability.
No pointers
Java does not support the concept of pointers. There is no address-of operator like &,
dereference operator like * or −>, or sizeof operator. Pointers are a source of bugs.
No goto statement
Java doesn't support a goto statement. Use of goto is regarded as poor
programming practice. Java adds labeled break and continue statements to the
flow-control statements offered by C. These are a good substitute for goto.
Garbage collection
The Java Virtual Machine performs garbage collection so that Java programmers do
not have to explicitly manage the memory used by all objects and arrays. This feature
eliminates another entire category of common bugs. It also eliminates memory leaks
from Java programs.
Variable declarations anywhere
C requires local variable declarations to be made at the beginning of a method or
block, while Java allows them anywhere in a method or block.
Forward Reference
In C, functions must be declared in a header file before defining them. The Java
compiler allows methods (functions) to be invoked before they are defined.
Miscellaneous Features
Java does not support the following features of C: typedef, variable-length argument
lists (e.g., used in printf () statement ), bitfields, enumerated types, structure and union
types.

Java Environment
.

In Java programming language, all source code is first written in plain text files ending with
the .java extension. Those source files are then compiled into .class files by the javac
compiler. A .class file does not contain code that is native to your processor; it instead
Prof. Mukesh N Tekwani

Page 3 of 6
The Java Programming Language

contains bytecodes — the machine language of the Java Virtual Machine (Java VM). The
java launcher tool then runs your application with an instance of the Java Virtual Machine.
Because the Java VM is available on many different operating systems, the same .class files
are capable of running on Microsoft Windows, the Solaris TM Operating System (Solaris OS),
Linux, or Mac OS.

Java environment includes many tools and classes. The development tools are part the Java
Development Kit (JDK) and the classes and methods are part of the Java Standard Library
(JSL).

Java Development Kit
The JDK includes:
javac –

Java compiler which translates the Java source code into bytecode.

java

–

Java interpreter which runs applications by reading the bytecode files.

jdb

–

Java debugger, which helps in debugging Java code

javap –

Java disassembler, which converts bytecode files into a program description

appletviewer – for viewing Java applets without using a Java-enabled browser

The Java Platform
A platform is the hardware or software environment in which a program runs. Some of the
most popular platforms are Microsoft Windows, Linux, Solaris OS, and Mac OS. Most
platforms can be described as a combination of the operating system and underlying
Page 4 of 6

Java - Chapter 1
The Java Programming Language

hardware. The Java platform differs from most other platforms in that it's a software-only
platform that runs on top of other hardware-based platforms.
The Java platform has two components:
•
•

The Java Virtual Machine
The Java Application Programming Interface (API)

Java Virtual Machine:
Java Virtual Machine is the base for the Java platform and is ported onto various hardwarebased platforms. A Virtual Machine is a software that that creates a virtualized environment
between the computer platform so that the end-user can operate software. Computer platform
includes computer’s hardware, operating system, and programming languages.
The Java Virtual Machine (JVM) is key to the independence of the underlying operating
system and hardware - it is a platform that hides the underlying operating system from Javapowered applets and applications.
1. The Java Virtual Machine, or JVM, is an abstract computer that runs compiled Java
programs.
2. The JVM is "virtual" because it is generally implemented in software on top of a
"real" hardware platform and operating system.
3. All Java programs are compiled for the JVM. Therefore, the JVM must be
implemented on a particular platform before compiled Java programs will run on that
platform.
Compiled Java Programs
Java Virtual Machine
Hardware Platform and Operating System
4. Virtual Machine defines a machine-independent format for binary files called the
class (.class) file format. This format includes instructions for a virtual computer in
the form of bytecodes.

The API
The API is a large collection of ready-made software components that provide many useful
capabilities. It is grouped into libraries of related classes and interfaces; these libraries are
known as packages. The API and Java Virtual Machine insulate the program from the
underlying hardware.

Prof. Mukesh N Tekwani

Page 5 of 6
The Java Programming Language

Advantages of Java
1.
2.
3.
4.
5.
6.

Easy to learn especially for those familiar with C or C++
Programs written in Java are usually smaller than in other languages.
Automatic garbage collection – avoids memory leaks.
Program development time is less in Java.
Platform dependencies can be avoided.
Applications written in Java are complied into machine-independent bytecode, and so
they run consistently on any Java platform.

QUESTIONS
1. Why is Java known as platform-independent language?
2. Explain the term bytecode. Why is Java said to be compiled as well as interpreted?
3. In what way is Java a robust language?
4. Which features of C language are missing from Java? Give at least 5 features.
5. List the components of the JDK. State the function of each of these components.
6. Java is multithreaded, dynamic and extensible. What does this mean for the programmer?
7. In the context of programming languages, define the term “platform”. Elaborate on the
two components of Java platform.

Page 6 of 6

Java - Chapter 1

More Related Content

What's hot

Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java ProgrammingRavi Kant Sahu
 
Fundamental programming structures in java
Fundamental programming structures in javaFundamental programming structures in java
Fundamental programming structures in javaShashwat Shriparv
 
Interface in java ,multiple inheritance in java, interface implementation
Interface in java ,multiple inheritance in java, interface implementationInterface in java ,multiple inheritance in java, interface implementation
Interface in java ,multiple inheritance in java, interface implementationHoneyChintal
 
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAndroid User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAhsanul Karim
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in javaTech_MX
 
Data Types, Variables, and Operators
Data Types, Variables, and OperatorsData Types, Variables, and Operators
Data Types, Variables, and OperatorsMarwa Ali Eissa
 
Inheritance and interface
Inheritance and interfaceInheritance and interface
Inheritance and interfaceShubham Sharma
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in javaRahulAnanda1
 

What's hot (20)

Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
Data types in java
Data types in javaData types in java
Data types in java
 
Tcp/ip server sockets
Tcp/ip server socketsTcp/ip server sockets
Tcp/ip server sockets
 
OOP Assignment 03.pdf
OOP Assignment 03.pdfOOP Assignment 03.pdf
OOP Assignment 03.pdf
 
Introduction to C++
Introduction to C++Introduction to C++
Introduction to C++
 
.Net
.Net.Net
.Net
 
C++ programming
C++ programmingC++ programming
C++ programming
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
interface in c#
interface in c#interface in c#
interface in c#
 
java notes.pdf
java notes.pdfjava notes.pdf
java notes.pdf
 
Fundamental programming structures in java
Fundamental programming structures in javaFundamental programming structures in java
Fundamental programming structures in java
 
Interface in java ,multiple inheritance in java, interface implementation
Interface in java ,multiple inheritance in java, interface implementationInterface in java ,multiple inheritance in java, interface implementation
Interface in java ,multiple inheritance in java, interface implementation
 
Java String class
Java String classJava String class
Java String class
 
Interfaces c#
Interfaces c#Interfaces c#
Interfaces c#
 
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAndroid User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
 
Data Types, Variables, and Operators
Data Types, Variables, and OperatorsData Types, Variables, and Operators
Data Types, Variables, and Operators
 
Inheritance and interface
Inheritance and interfaceInheritance and interface
Inheritance and interface
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 

Viewers also liked

Python reading and writing files
Python reading and writing filesPython reading and writing files
Python reading and writing filesMukesh Tekwani
 
Digital signal and image processing FAQ
Digital signal and image processing FAQDigital signal and image processing FAQ
Digital signal and image processing FAQMukesh Tekwani
 
Phases of the Compiler - Systems Programming
Phases of the Compiler - Systems ProgrammingPhases of the Compiler - Systems Programming
Phases of the Compiler - Systems ProgrammingMukesh Tekwani
 
Java chapter 6 - Arrays -syntax and use
Java chapter 6 - Arrays -syntax and useJava chapter 6 - Arrays -syntax and use
Java chapter 6 - Arrays -syntax and useMukesh Tekwani
 
Java chapter 3 - OOPs concepts
Java chapter 3 - OOPs conceptsJava chapter 3 - OOPs concepts
Java chapter 3 - OOPs conceptsMukesh Tekwani
 
Python - Regular Expressions
Python - Regular ExpressionsPython - Regular Expressions
Python - Regular ExpressionsMukesh Tekwani
 
Data communications ch 1
Data communications   ch 1Data communications   ch 1
Data communications ch 1Mukesh Tekwani
 
Chap 3 data and signals
Chap 3 data and signalsChap 3 data and signals
Chap 3 data and signalsMukesh Tekwani
 
Chapter 26 - Remote Logging, Electronic Mail & File Transfer
Chapter 26 - Remote Logging, Electronic Mail & File TransferChapter 26 - Remote Logging, Electronic Mail & File Transfer
Chapter 26 - Remote Logging, Electronic Mail & File TransferWayne Jones Jnr
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programmingMukesh Tekwani
 

Viewers also liked (19)

Html tables examples
Html tables   examplesHtml tables   examples
Html tables examples
 
Python reading and writing files
Python reading and writing filesPython reading and writing files
Python reading and writing files
 
Jdbc 1
Jdbc 1Jdbc 1
Jdbc 1
 
Java chapter 3
Java   chapter 3Java   chapter 3
Java chapter 3
 
Java chapter 5
Java chapter 5Java chapter 5
Java chapter 5
 
Digital signal and image processing FAQ
Digital signal and image processing FAQDigital signal and image processing FAQ
Digital signal and image processing FAQ
 
Java misc1
Java misc1Java misc1
Java misc1
 
Phases of the Compiler - Systems Programming
Phases of the Compiler - Systems ProgrammingPhases of the Compiler - Systems Programming
Phases of the Compiler - Systems Programming
 
Java 1-contd
Java 1-contdJava 1-contd
Java 1-contd
 
Java swing 1
Java swing 1Java swing 1
Java swing 1
 
Java chapter 6 - Arrays -syntax and use
Java chapter 6 - Arrays -syntax and useJava chapter 6 - Arrays -syntax and use
Java chapter 6 - Arrays -syntax and use
 
Java chapter 3 - OOPs concepts
Java chapter 3 - OOPs conceptsJava chapter 3 - OOPs concepts
Java chapter 3 - OOPs concepts
 
Python - Regular Expressions
Python - Regular ExpressionsPython - Regular Expressions
Python - Regular Expressions
 
Html graphics
Html graphicsHtml graphics
Html graphics
 
Data Link Layer
Data Link Layer Data Link Layer
Data Link Layer
 
Data communications ch 1
Data communications   ch 1Data communications   ch 1
Data communications ch 1
 
Chap 3 data and signals
Chap 3 data and signalsChap 3 data and signals
Chap 3 data and signals
 
Chapter 26 - Remote Logging, Electronic Mail & File Transfer
Chapter 26 - Remote Logging, Electronic Mail & File TransferChapter 26 - Remote Logging, Electronic Mail & File Transfer
Chapter 26 - Remote Logging, Electronic Mail & File Transfer
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programming
 

Similar to Java chapter 1

Unit1 introduction to Java
Unit1 introduction to JavaUnit1 introduction to Java
Unit1 introduction to JavaDevaKumari Vijay
 
JAVA ALL 5 MODULE NOTES.pptx
JAVA ALL 5 MODULE NOTES.pptxJAVA ALL 5 MODULE NOTES.pptx
JAVA ALL 5 MODULE NOTES.pptxDrPreethiD1
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfUmesh Kumar
 
JAVA PROGRAMMING-Unit I - Final PPT.pptx
JAVA PROGRAMMING-Unit I - Final PPT.pptxJAVA PROGRAMMING-Unit I - Final PPT.pptx
JAVA PROGRAMMING-Unit I - Final PPT.pptxSuganthiDPSGRKCW
 
0f0cef_1dac552af56c4338ab0672859199e693.pdf
0f0cef_1dac552af56c4338ab0672859199e693.pdf0f0cef_1dac552af56c4338ab0672859199e693.pdf
0f0cef_1dac552af56c4338ab0672859199e693.pdfDeepakChaudhriAmbali
 
Notes of java first unit
Notes of java first unitNotes of java first unit
Notes of java first unitgowher172236
 
Java Lecture 1
Java Lecture 1Java Lecture 1
Java Lecture 1Qualys
 
Sybsc cs sem 3 core java
Sybsc cs sem 3 core javaSybsc cs sem 3 core java
Sybsc cs sem 3 core javaWE-IT TUTORIALS
 
Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...Mr. Akaash
 
java introduction.docx
java introduction.docxjava introduction.docx
java introduction.docxvikasbagra9887
 
Java programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruJava programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruNithin Kumar,VVCE, Mysuru
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objectsvmadan89
 

Similar to Java chapter 1 (20)

Java ms harsha
Java ms harshaJava ms harsha
Java ms harsha
 
Unit1 introduction to Java
Unit1 introduction to JavaUnit1 introduction to Java
Unit1 introduction to Java
 
Unit1 JAVA.pptx
Unit1 JAVA.pptxUnit1 JAVA.pptx
Unit1 JAVA.pptx
 
OOPS JAVA.pdf
OOPS JAVA.pdfOOPS JAVA.pdf
OOPS JAVA.pdf
 
Java1
Java1Java1
Java1
 
Java
Java Java
Java
 
JAVA ALL 5 MODULE NOTES.pptx
JAVA ALL 5 MODULE NOTES.pptxJAVA ALL 5 MODULE NOTES.pptx
JAVA ALL 5 MODULE NOTES.pptx
 
Java features
Java  features Java  features
Java features
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdf
 
JAVA PROGRAMMING-Unit I - Final PPT.pptx
JAVA PROGRAMMING-Unit I - Final PPT.pptxJAVA PROGRAMMING-Unit I - Final PPT.pptx
JAVA PROGRAMMING-Unit I - Final PPT.pptx
 
0f0cef_1dac552af56c4338ab0672859199e693.pdf
0f0cef_1dac552af56c4338ab0672859199e693.pdf0f0cef_1dac552af56c4338ab0672859199e693.pdf
0f0cef_1dac552af56c4338ab0672859199e693.pdf
 
Notes of java first unit
Notes of java first unitNotes of java first unit
Notes of java first unit
 
Java Lecture 1
Java Lecture 1Java Lecture 1
Java Lecture 1
 
Sybsc cs sem 3 core java
Sybsc cs sem 3 core javaSybsc cs sem 3 core java
Sybsc cs sem 3 core java
 
Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...
 
Java unit 1
Java unit 1Java unit 1
Java unit 1
 
java introduction.docx
java introduction.docxjava introduction.docx
java introduction.docx
 
Java programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruJava programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, Mysuru
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
 
Java 3 rd sem. 2012 aug.ASSIGNMENT
Java 3 rd sem. 2012 aug.ASSIGNMENTJava 3 rd sem. 2012 aug.ASSIGNMENT
Java 3 rd sem. 2012 aug.ASSIGNMENT
 

More from Mukesh Tekwani

Computer Science Made Easy - Youtube Channel
Computer Science Made Easy - Youtube ChannelComputer Science Made Easy - Youtube Channel
Computer Science Made Easy - Youtube ChannelMukesh Tekwani
 
The Elphinstonian 1988-College Building Centenary Number (2).pdf
The Elphinstonian 1988-College Building Centenary Number (2).pdfThe Elphinstonian 1988-College Building Centenary Number (2).pdf
The Elphinstonian 1988-College Building Centenary Number (2).pdfMukesh Tekwani
 
ISCE-Class 12-Question Bank - Electrostatics - Physics
ISCE-Class 12-Question Bank - Electrostatics  -  PhysicsISCE-Class 12-Question Bank - Electrostatics  -  Physics
ISCE-Class 12-Question Bank - Electrostatics - PhysicsMukesh Tekwani
 
Hexadecimal to binary conversion
Hexadecimal to binary conversion Hexadecimal to binary conversion
Hexadecimal to binary conversion Mukesh Tekwani
 
Hexadecimal to decimal conversion
Hexadecimal to decimal conversion Hexadecimal to decimal conversion
Hexadecimal to decimal conversion Mukesh Tekwani
 
Hexadecimal to octal conversion
Hexadecimal to octal conversionHexadecimal to octal conversion
Hexadecimal to octal conversionMukesh Tekwani
 
Gray code to binary conversion
Gray code to binary conversion Gray code to binary conversion
Gray code to binary conversion Mukesh Tekwani
 
Decimal to Binary conversion
Decimal to Binary conversionDecimal to Binary conversion
Decimal to Binary conversionMukesh Tekwani
 
Video Lectures for IGCSE Physics 2020-21
Video Lectures for IGCSE Physics 2020-21Video Lectures for IGCSE Physics 2020-21
Video Lectures for IGCSE Physics 2020-21Mukesh Tekwani
 
Refraction and dispersion of light through a prism
Refraction and dispersion of light through a prismRefraction and dispersion of light through a prism
Refraction and dispersion of light through a prismMukesh Tekwani
 
Refraction of light at a plane surface
Refraction of light at a plane surfaceRefraction of light at a plane surface
Refraction of light at a plane surfaceMukesh Tekwani
 
Atom, origin of spectra Bohr's theory of hydrogen atom
Atom, origin of spectra Bohr's theory of hydrogen atomAtom, origin of spectra Bohr's theory of hydrogen atom
Atom, origin of spectra Bohr's theory of hydrogen atomMukesh Tekwani
 
Refraction of light at spherical surfaces of lenses
Refraction of light at spherical surfaces of lensesRefraction of light at spherical surfaces of lenses
Refraction of light at spherical surfaces of lensesMukesh Tekwani
 
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGE
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGEISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGE
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGEMukesh Tekwani
 

More from Mukesh Tekwani (20)

Computer Science Made Easy - Youtube Channel
Computer Science Made Easy - Youtube ChannelComputer Science Made Easy - Youtube Channel
Computer Science Made Easy - Youtube Channel
 
The Elphinstonian 1988-College Building Centenary Number (2).pdf
The Elphinstonian 1988-College Building Centenary Number (2).pdfThe Elphinstonian 1988-College Building Centenary Number (2).pdf
The Elphinstonian 1988-College Building Centenary Number (2).pdf
 
Circular motion
Circular motionCircular motion
Circular motion
 
Gravitation
GravitationGravitation
Gravitation
 
ISCE-Class 12-Question Bank - Electrostatics - Physics
ISCE-Class 12-Question Bank - Electrostatics  -  PhysicsISCE-Class 12-Question Bank - Electrostatics  -  Physics
ISCE-Class 12-Question Bank - Electrostatics - Physics
 
Hexadecimal to binary conversion
Hexadecimal to binary conversion Hexadecimal to binary conversion
Hexadecimal to binary conversion
 
Hexadecimal to decimal conversion
Hexadecimal to decimal conversion Hexadecimal to decimal conversion
Hexadecimal to decimal conversion
 
Hexadecimal to octal conversion
Hexadecimal to octal conversionHexadecimal to octal conversion
Hexadecimal to octal conversion
 
Gray code to binary conversion
Gray code to binary conversion Gray code to binary conversion
Gray code to binary conversion
 
What is Gray Code?
What is Gray Code? What is Gray Code?
What is Gray Code?
 
Decimal to Binary conversion
Decimal to Binary conversionDecimal to Binary conversion
Decimal to Binary conversion
 
Video Lectures for IGCSE Physics 2020-21
Video Lectures for IGCSE Physics 2020-21Video Lectures for IGCSE Physics 2020-21
Video Lectures for IGCSE Physics 2020-21
 
Refraction and dispersion of light through a prism
Refraction and dispersion of light through a prismRefraction and dispersion of light through a prism
Refraction and dispersion of light through a prism
 
Refraction of light at a plane surface
Refraction of light at a plane surfaceRefraction of light at a plane surface
Refraction of light at a plane surface
 
Spherical mirrors
Spherical mirrorsSpherical mirrors
Spherical mirrors
 
Atom, origin of spectra Bohr's theory of hydrogen atom
Atom, origin of spectra Bohr's theory of hydrogen atomAtom, origin of spectra Bohr's theory of hydrogen atom
Atom, origin of spectra Bohr's theory of hydrogen atom
 
Refraction of light at spherical surfaces of lenses
Refraction of light at spherical surfaces of lensesRefraction of light at spherical surfaces of lenses
Refraction of light at spherical surfaces of lenses
 
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGE
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGEISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGE
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGE
 
Cyber Laws
Cyber LawsCyber Laws
Cyber Laws
 
XML
XMLXML
XML
 

Recently uploaded

Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 

Recently uploaded (20)

Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 

Java chapter 1

  • 1. 1. THE JAVA PROGRAMMING LANGUAGE What is Java? Java programming language is a high-level language that can be characterized by all of the following buzzwords: • Compiled and Interpreted • Architecture neutral • Distributed • Object oriented • Robust • Secure • Multithreaded • Dynamic • Extensible • High performance • Easy to learn Java features elaborated: 1. Compiled and Interpreted Usually a computer language is either compiled or interpreted. Java combines both these features and thus there are two stages involved in a Java program. First, Java translates the source code into bytecode instructions. Bytecodes are not machine instructions. So in the next stage, the Java interpreter generates the machine code that can be directly executed by the machine that is running the Java program. This interpretation is done by the Java virtual machine. 2. Platform-independent and portable Java programs can be easily moved from one computer system to another. If there are any changes in the OS, processor, and other system resources, there is no need to change the Java program. This portability is achieved in two ways: first Java generates the bytecode instructions that can be run on any machine. Also, the size of the primitive data types are machine independent. This portability is the reason behind the huge success of Java in the networking domain, especially the Internet. We can download an applet from a remote computer to our computer system and execute it locally. 3. Distributed Java was designed with networking in mind. Java programs can share data across networks. Java programs can open and access objects on network devices. 4. Object-oriented Java is object oriented. No coding is permitted outside class definitions. An extensive class library can be used by the programmer 5. Robust Java is a robust language. All local variables must be initialized. There is strong typechecking. That is, all data must be declared explicitly. It has garbage-collection features which means that memory management is no longer something the programmer needs to Java - Chapter 1 Page 1 of 6
  • 2. The Java Programming Language be worried about. Java also does exception handling – serious errors are captured and the risk of crashing the system is minimized. 6. Secure Since Java has been designed for networked environments, security is an important feature of this language. Java systems verify all memory accesses. The absence of pointers in Java ensures that programs do not have access to all memory locations. 7. Multithreaded Multithreading means handling many (multiple) tasks simultaneously. Java handles multithreaded programs. It means that we need not wait for one task to be completed before starting the next task. Such systems are very useful for graphical interactive environments. 8. Dynamic and extensible The linking of data and methods to where they are located, is done at run-time. New classes can be loaded while a program is running. Linking is done on the fly. Even if libraries are recompiled, there is no need to recompile code that uses classes in those libraries. This differs from C++, which uses static binding. By extensible we mean that Java programs can support functions written in other languages such as C or C++. These functions are called native methods. Such functions are linked dynamically at runtime. 9. High performance Even though Java is interpreted (in the second stage), its speed is impressive compared to other interpreted languages. This is due to the use of the intermediate bytecode. Also, the multithreading feature further increases the speed of execution of Java programs. 10. Simple to learn Java is a simple and small language. Many features of C / C++ have been removed from Java. For example, pointers, preprocessor header files (e.g., #include <stdio.h>), goto statement, operator overloading, multiple inheritance, etc have been eliminated from Java. Differences between Java and C: Although Java syntax is in many ways including operators and statements, there are many significant differences in these languages. No preprocessor Java does not include a preprocessor(C and C++ both have the #include preprocessor directive). Also #define, #ifdef are missing from Java. No macro definitions Java does not support macros (#define in C). Page 2 of 6 Java - Chapter 1
  • 3. The Java Programming Language No global variables There are no global variables in Java. Packages contain classes, classes contain fields and methods, and methods contain local variables. Well-defined primitive data types All primitive data types in Java have well-defined sizes. In C, the size of short, int, and long data types is platform-dependent. This hampers portability. No pointers Java does not support the concept of pointers. There is no address-of operator like &, dereference operator like * or −>, or sizeof operator. Pointers are a source of bugs. No goto statement Java doesn't support a goto statement. Use of goto is regarded as poor programming practice. Java adds labeled break and continue statements to the flow-control statements offered by C. These are a good substitute for goto. Garbage collection The Java Virtual Machine performs garbage collection so that Java programmers do not have to explicitly manage the memory used by all objects and arrays. This feature eliminates another entire category of common bugs. It also eliminates memory leaks from Java programs. Variable declarations anywhere C requires local variable declarations to be made at the beginning of a method or block, while Java allows them anywhere in a method or block. Forward Reference In C, functions must be declared in a header file before defining them. The Java compiler allows methods (functions) to be invoked before they are defined. Miscellaneous Features Java does not support the following features of C: typedef, variable-length argument lists (e.g., used in printf () statement ), bitfields, enumerated types, structure and union types. Java Environment . In Java programming language, all source code is first written in plain text files ending with the .java extension. Those source files are then compiled into .class files by the javac compiler. A .class file does not contain code that is native to your processor; it instead Prof. Mukesh N Tekwani Page 3 of 6
  • 4. The Java Programming Language contains bytecodes — the machine language of the Java Virtual Machine (Java VM). The java launcher tool then runs your application with an instance of the Java Virtual Machine. Because the Java VM is available on many different operating systems, the same .class files are capable of running on Microsoft Windows, the Solaris TM Operating System (Solaris OS), Linux, or Mac OS. Java environment includes many tools and classes. The development tools are part the Java Development Kit (JDK) and the classes and methods are part of the Java Standard Library (JSL). Java Development Kit The JDK includes: javac – Java compiler which translates the Java source code into bytecode. java – Java interpreter which runs applications by reading the bytecode files. jdb – Java debugger, which helps in debugging Java code javap – Java disassembler, which converts bytecode files into a program description appletviewer – for viewing Java applets without using a Java-enabled browser The Java Platform A platform is the hardware or software environment in which a program runs. Some of the most popular platforms are Microsoft Windows, Linux, Solaris OS, and Mac OS. Most platforms can be described as a combination of the operating system and underlying Page 4 of 6 Java - Chapter 1
  • 5. The Java Programming Language hardware. The Java platform differs from most other platforms in that it's a software-only platform that runs on top of other hardware-based platforms. The Java platform has two components: • • The Java Virtual Machine The Java Application Programming Interface (API) Java Virtual Machine: Java Virtual Machine is the base for the Java platform and is ported onto various hardwarebased platforms. A Virtual Machine is a software that that creates a virtualized environment between the computer platform so that the end-user can operate software. Computer platform includes computer’s hardware, operating system, and programming languages. The Java Virtual Machine (JVM) is key to the independence of the underlying operating system and hardware - it is a platform that hides the underlying operating system from Javapowered applets and applications. 1. The Java Virtual Machine, or JVM, is an abstract computer that runs compiled Java programs. 2. The JVM is "virtual" because it is generally implemented in software on top of a "real" hardware platform and operating system. 3. All Java programs are compiled for the JVM. Therefore, the JVM must be implemented on a particular platform before compiled Java programs will run on that platform. Compiled Java Programs Java Virtual Machine Hardware Platform and Operating System 4. Virtual Machine defines a machine-independent format for binary files called the class (.class) file format. This format includes instructions for a virtual computer in the form of bytecodes. The API The API is a large collection of ready-made software components that provide many useful capabilities. It is grouped into libraries of related classes and interfaces; these libraries are known as packages. The API and Java Virtual Machine insulate the program from the underlying hardware. Prof. Mukesh N Tekwani Page 5 of 6
  • 6. The Java Programming Language Advantages of Java 1. 2. 3. 4. 5. 6. Easy to learn especially for those familiar with C or C++ Programs written in Java are usually smaller than in other languages. Automatic garbage collection – avoids memory leaks. Program development time is less in Java. Platform dependencies can be avoided. Applications written in Java are complied into machine-independent bytecode, and so they run consistently on any Java platform. QUESTIONS 1. Why is Java known as platform-independent language? 2. Explain the term bytecode. Why is Java said to be compiled as well as interpreted? 3. In what way is Java a robust language? 4. Which features of C language are missing from Java? Give at least 5 features. 5. List the components of the JDK. State the function of each of these components. 6. Java is multithreaded, dynamic and extensible. What does this mean for the programmer? 7. In the context of programming languages, define the term “platform”. Elaborate on the two components of Java platform. Page 6 of 6 Java - Chapter 1