Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Study Note on Java - Overview of Java Language

Rating
-
Sold
-
Pages
4
Uploaded on
28-02-2022
Written in
2021/2022

Study Note on Java - Overview of Java Language

Institution
Course

Content preview

Chapter 3: Overview of Java Language

3.1 Simple JAVA Program
Class SampleOne
{
Public static void main (String args[])
{
System.out.println (“Java is better than C++.”);
}
}
3.1.1 Class Declaration
The first line
Class SampleOne
Declares a class. As Java is a object-oriented language and therefore everything must be placed inside a
class. Class is a keyword and declares that a new class definition follows. SampleOne is a Java identifier
that specifies the name of the class to be defined.
3.1.2 Opening Brace
Every class definition in Java begins with an opening brace “{“ and ends with a matching closing brace
“}”.
3.1.3 The main Line
Public static void main (String args[])
Keyword Description
Public The keyword public is an access specifier that declares the main method as
unprotected and therefore making it accessible to all other classes.
Static Static which declares this method as one that belongs to the entire class and
not a part of any objects of the class. The main always be declared as static
since interpreter uses this method before any objects are created.
Void The type modifier void states that the main method does not return any value.

3.1.4 The Output Line
System.out.println (“Java is better than C++.”);
This line prints the string Java is better than C++. To the screen. Every Java statement must end with a
semicolon.

3.2 Java Program Structure
3.2.1. Documentation Section
The documentation section comprises a set of comment lines giving the name of the program, the
author and other details. Comments must explain why and what of classes and how of algorithms.
/**…… */ this form of comment is called documentation comment.
3.2.2. package Statement
The first statement allowed in a Java file is a package statement. This statement declares a package
name and informs the compiler that the classes defined here belong to this package.
Example:
Package student;
Package statement is optional.
3.2.3. Import Statements
The next thing after a package statement may be several import statements.

Connected book

Written for

Institution
Course

Document information

Uploaded on
February 28, 2022
Number of pages
4
Written in
2021/2022
Type
Class notes
Professor(s)
Mrs. prabitha
Contains
All classes

Subjects

$7.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
sinithomas

Also available in package deal

Get to know the seller

Seller avatar
sinithomas Study Notes
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
4 year
Number of followers
0
Documents
10
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

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

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions