100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Java project $10.49   Add to cart

Class notes

Java project

 6 views  0 purchase
  • Course
  • Institution
  • Book

My documents briefly explain about the java

Preview 4 out of 330  pages

  • May 23, 2024
  • 330
  • 2023/2024
  • Class notes
  • Kurusamy
  • All classes
avatar-seller
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

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller gobikasenthilkumar. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $10.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

75619 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$10.49
  • (0)
  Add to cart