100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Class notes

Java project

Rating
-
Sold
-
Pages
330
Uploaded on
23-05-2024
Written in
2023/2024

My documents briefly explain about the java

Institution
Course











Whoops! We can’t load your doc right now. Try again or contact support.

Connected book

Written for

Course

Document information

Uploaded on
May 23, 2024
Number of pages
330
Written in
2023/2024
Type
Class notes
Professor(s)
Kurusamy
Contains
All classes

Subjects

Content preview

UNIT I
LESSON 1
Objectives:
The aim of this Lesson is to impart knowledge on
 overview of several key features of Java
 the object oriented paradigm
 the buzzwords of Java
 the data types, variables and arrays

Introduction
Java programming language was originally
developed by Sun Microsystems which was initiated by
James Gosling and released in 1995 as core component
of Sun Microsystems‘ Java platform (Java 1.0 [J2SE]).
With the advancement of Java and its widespread
popularity, multiple configurations were built to suite
various types of platforms. Ex: J2EE for Enterprise
Applications, J2ME for Mobile Applications. Sun
Microsystems has renamed the new J2 versions as Java
SE, Java EE and Java ME, respectively.
Java is guaranteed to be Write Once, Run
Anywhere. Java can be used to create two types of
programs: applications and applets. An application is a
program that runs on your computer, under the operating
system of that computer. An applet is an application
designed to be transmitted over the Internet and executed
by a Java-compatible Web browser. An applet is an
intelligent program that can react to user input and
dynamically change. It can also run the animation or
sound in the Web browser.



Programming in Java 1

,1.1 Overview of Java
Java is an Object-oriented programming
language. All computer programs consist of two
elements: code and data. Object-oriented programming
organizes a program around its data (that is, objects) and
a set of well-defined interfaces to that data. An object-
oriented program can be characterized as data controlling
access to code. Object means a real word entity such as
pen, chair, table etc. Object-Oriented Programming is a
methodology or paradigm to design a program using
classes and objects. It simplifies the software
development and maintenance by providing some
concepts:
 Object: Any entity that has state and behavior is
known as an object. For example: chair, pen, table,
keyboard, bike etc. It can be physical and logical.
 Class: Collection of objects is called class. It is a
logical entity.
 Inheritance: Inheritance is the process by which
one object acquires the properties of another
object. This is important because it supports the
concept of hierarchical classification. It provides
code reusability. It is used to achieve runtime
polymorphism.
 Polymorphism: Polymorphism is the ability of an
object to take on many forms. The most common
use of polymorphism in OOP occurs when a parent
class reference is used to refer to a child class
object. For example: to draw something e.g. shape
or rectangle etc. In java, we use method
overloading and method overriding to achieve
polymorphism.

Programming in Java 2

,  Abstraction: Hiding internal details and showing
functionality is known as abstraction. For example:
phone call, we don't know the internal processing.
In java, we use abstract class and interface to
achieve abstraction.
 Encapsulation: Binding (or wrapping) code and
data together into a single unit is known as
encapsulation. For example: capsule, it is wrapped
with different medicines. A java class is the
example of encapsulation. Java bean is the fully
encapsulated class because all the data members
are private here.
A First Simple Program
A simple java program name Example.java is
shown in Figure 1.1. The program begins with the
following lines:
/* This is a simple Java program.
Call this file "Example.java".
*/
This is a multi-line comment. Like most other
programming languages, Java lets the user to enter a
remark into a program‘s source file. The contents of a
comment are ignored by the compiler.

PROGRAM
/*
This is a simple Java program.
Call this file "Example.java".
*/
class Example {
// Your program begins with a call to main().
public static void main(String args[]) {

Programming in Java 3

, System.out.println("This is a simple Java program.");
}
}
Fig. 1.1 First Java Program

Compiling the Program
To compile the Example program, execute the
compiler, javac, specifying the name of the source file
on the command line, as shown here:
C:\>javac Example.java
The javac compiler creates a file called Example.class
that contains the bytecode version of the program. As
discussed earlier, the Java bytecode is the intermediate
representation of your program that contains instructions
the Java interpreter will execute. Thus, the output of
javac is not code that can be directly executed. To
actually run the program, you must use the Java
interpreter, called java. To do so, pass the class name
Example as a command-line argument, as shown here:
C:\>java Example
When the program is run, the following output is
displayed:
This is a simple Java program.
The next line of code in the program is shown here:
class Example {
This line uses the keyword class to declare that a new
class is being defined. Example is an identifier that is
the name of the class. The entire class definition,
including all of its members, will be between the
opening curly brace ({) and the closing curly brace (}).
The next line in the program is the single-line comment,
shown here:

Programming in Java 4
$10.49
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
gobikasenthilkumar

Get to know the seller

Seller avatar
gobikasenthilkumar Arts and science
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
1 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions