Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Java Programming Language

Programming Language II

Chapter1

Lecture Note

Introduction to Java

We will discusses this chapter fundamental concept of programming language, classification of


programming language, Object Oriented Programming Language, introduction to Java programming
concept including java definitions, history , characteristics, Anatomy of a Java program, why we use java
and drawbacks of java.

Introduction to Programming

Programming Languages are important for software technologies. It is a basic one, without it programming
could not do anything about application software. It is a key factor to every application software since
a programming language is a formal language comprising a set of instructions that produce various kinds
of output. Programming languages are used in computer programming to implement algorithms.

A programming language defines a set of instructions that are compiled together to perform a specific task
by the CPU (Central Processing Unit). Each programming language contains a unique set of keywords and
syntax, which are used to create a set of instructions.

Thousands of programming languages have been developed till now, but each language has its specific
purpose. These languages vary in the level of abstraction they provide from the hardware. Mostly
programming language can be classified into two categories: Low-level language and High-level language

Page 1
Java Programming Language

Object Oriented Programming


Object-Oriented Programming (OOP) is a programming paradigm which uses objects – data structures
which consist of data fields and methods together with their interactions to design applications and computer
programs.

Object-oriented programming based on the following principles:

 Encapsulation- The implementation and state of each object are privately held inside a defined
boundary, or class. Other objects do not have access to this class or the authority to make changes but
are only able to call a list of public functions, or methods. This characteristic of data hiding provides
greater program security and avoids unintended data corruption.

 Abstraction- Objects only reveal internal mechanisms that are relevant for the use of other objects,
hiding any unnecessary implementation code. This concept helps developers make changes and
additions over time more easily.

 Inheritance- Relationships and subclasses between objects, it allows developers to reuse a common logic
while still maintaining a unique hierarchy. This property of OOP forces a more thorough data analysis,
reduces development time and ensures a higher level of accuracy.

Page 2
Java Programming Language
 Polymorphism- Objects are allowed to take on more than one form depending on the context. The
program will determine which meaning or usage is necessary for each execution of that object, cutting
down on the need to duplicate code.

What is Java Programming Language

Java is a computer programming language that enables programmers to write computer instructions using
English-based commands instead of having to write in numeric codes.

Java is one of a high-level language because it can be read and written easily by humans.

Java was originally designed for use on digital mobile devices, such as cellphones for Android applications
and is also among the most favored for the development of edge devices and the internet of things.

Java is a class-based, object-oriented programming language that is designed to have as few


implementation dependencies as possible. It is a general-purpose programming language intended to
let application developers write once and run anywhere.

Java enables users to develop and deploy applications on:

 Java Applets

 Java Web Applications

 Small hand-held devices and others

Java’s History

 Developed by a team led by James Gosling at Sun Microsystems.

 Originally called oak (1991) for use in embedded consumer electronic applications.

 In 1995, renamed Java, it was redesigned for developing Internet applications.

 Java programs can be embedded in HTML pages and downloaded by Web browsers to bring live
animation and interaction to web clients.

 Can also be used to develop standalone applications.

 Java was designed from the start to be object–oriented.

Characteristics of Java
Page 3
Java Programming Language

Java is Simple

 Java is Easy to write and more readable and eye catching.


 Java has a concise, cohesive set of features that makes it easy to learn and use.
 Most of the concepts are drew from C++ thus making Java learning simpler.

Java is Object-Oriented

 Java programming is object-oriented programming language.


 Like C++ java provides most of the object oriented features.
 Java is pure OOP. Language. (while C++ is semi object oriented)
 OOP programming provides great flexibility, modularity, and reusability.

Java is Distributed

 Distributed computing involves several computers working together on a network.


 Since network capability is inherently integrated into Java, writing network programs is like sending
and receiving data to and from a file.

Java is interpreted

 You need an interpreter to run Java programs. The programs into the Java Virtual Machine code called
bytecode. The bytecode is machine-independent and can run on any machine that has a Java interpreter.

Java is robust

 Robust means reliable. No programming language can ensure complete reliability.


 Java puts a lot of emphasis on early checking for possible errors, because Java compilers can detect many
problems that would first show up at execution time in other languages.
 Java has eliminated certain types of error-prone programming constructs found in other languages (pointers.)

Java is secure

 The Java platform is designed with security features built into the language and runtime system such as static
type-checking at compile time and runtime checking (security manager), which let you creating applications
that can’t be invaded from outside. You never hear about viruses attacking Java applications.
 If you download a Java applet and run it on your computer, it will not damage your system b/c Java
implements several security mechanisms to protect your system against harm caused by stray programs.
“Nothing should be trusted.”

Java is Portable
 Java programs can be run on any platform without being recompiled. There are no platform-specific features
in the Java language.
 In Java, the range of the integer is the same on every platform, as the behavior of arithmetic.

Java supports Multithreading

 Java is a multithreaded language that can run more than one thread at the same time. A thread is the
smallest unit of a process. Multithreading helps us to gain the maximum utilization of CPU. Multiple
threads share a common memory area and increase the efficiency and performance of the
application. These threads run independently of each other without affecting each other.

Page 4
Java Programming Language
Why Use Java?

 Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.)
 It is one of the most popular programming language in the world
 It is easy to learn and simple to use
 It is open-source and free
 It is secure, fast and powerful
 It has a huge community support (tens of millions of developers)
 Java is an object oriented language which gives a clear structure to programs and allows code to be
reused, lowering development costs
 As Java is close to C++ and C#, it makes it easy for programmers to switch to Java or vice versa

Anatomy of a Java Program

 Comments
 Package
 Reserved words
 Modifiers
 Statements
 Blocks
 Classes
 Methods
 The main method

Drawbacks of Java dis advantages

 Unfortunately, like any technology, Java has not only advantages but also a bunch of disadvantages. The
several significant cons of Java are:
 Costs for the commercial license.
 Java compiler is not well optimized yet compared to C++.
 There is no separation of specification from implementation.
 Memory management, with Java, is a little expensive.
 One can find some bugs in browsers and example programs.

Page 5

You might also like