0% found this document useful (0 votes)
4 views12 pages

Module1 Chapter3 Core Java

The document is a trainer manual for Core Java, specifically focusing on Java fundamentals and programming concepts. It covers the use of Java IDEs like Eclipse and NetBeans, basic syntax rules, and provides examples of Java code. Additionally, it includes practical exercises and assessments to evaluate student progress.

Uploaded by

himanshu867743
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views12 pages

Module1 Chapter3 Core Java

The document is a trainer manual for Core Java, specifically focusing on Java fundamentals and programming concepts. It covers the use of Java IDEs like Eclipse and NetBeans, basic syntax rules, and provides examples of Java code. Additionally, it includes practical exercises and assessments to evaluate student progress.

Uploaded by

himanshu867743
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

CORE JAVA

MANUAL V8.3

MODULE CODE:
DL.A.01.01

ANUDIP FOUNDATION
Trainer
Manual Core Java

1
Trainer
Manual Core Java

Module 1: Java Fundamental and Programming Concepts

Chapter 3

Objective: After completing this lesson you will be Materials Required:


able to :
* Get familiar with Eclipse and NetBeans Java IDEs 1. Computer
* Understand some basic syntax rules of Java 2. Internet access

Theory Duration: 90 minutes Practical Duration: 30 minutes

Total Duration: 120 minutes

2
Trainer
Manual Core Java

Chapter 3

3.1 IDE (Eclipse/NetBeans)

What is a Java IDE?

A Java Integrated Development Environment, abbreviated as Java IDE, is an environment for Java programming. It is a
software application consisting of a code editor, an interpreter or compiler, and a debugger. All components and
features of IDEs are accessed by programmers through a GUI (graphical user interface).

IDEs are preferred by programmers as they -


* Enable programmers to collaborate on development projects
* Facilitate faster and more organized coding
* Make it easier to manage development projects with the GUI
* Simplify repetitive tasks through automation and code completion features

Two popularly used Java integrated development environments (IDEs) are -


i) Eclipse
ii) NetBeans

Both of these IDEs offer the fundamental features and functionalities required for developing Java applications. Take
a look at some information regarding these two Java IDEs below.

i) Eclipse IDE
Eclipse is the most widely used Java IDE. It is an open source and free development environment that also supports
several other programming languages. Eclipse can be installed on the 32-bit and 64-bit versions of Windows, macOS
and Linux operating systems. It is available for free download at eclipse.org. Programs created on the Eclipse IDE are
licensed to the Eclipse Public License (EPL).

The GUI (graphical user interface of Eclipse IDE) -

3
Trainer
Manual Core Java

Eclipse features -
* Supports many plugins and extensions
* Code completion ensures lesser code writing
* Refactoring enhances and simplifies code
* Syntax checking aids code corrections while writing

ii) NetBeans IDE


NetBeans is an alternative preferred by many developers. It is a free and open source application that runs on macOS,
Windows, LInux and Solaris. NetBeans offers support for other languages and a GUI that facilitates ease of use. It is
available for free download at netbeans.org. Programs created on the NetBeans IDE are licensed to the Apache
License.

The GUI (graphical user interface of NetBeans IDE) -

4
Trainer
Manual Core Java

NetBeans features -

* Simple learning curve for beginners


* Large selection of inbuilt plugins
* Modern and intuitive features
* Easy workflow customization

3.2 Programming Syntax and Rules

Java programming syntax is the set of rules and standards for writing code correctly. Programmers must learn Java
syntax to write a valid program. The syntax of Java programming is quite similar to C and C++ languages. Java syntax
grows with the latest versions of the Java Development Kit (JDK).

5
Trainer
Manual Core Java

Example of a Java Code Syntax

In Java syntax -
* Values are known as ‘objects’
* Code belongs to ‘classes’
* Primitive data types are not assigned ‘classes’

Basic syntax guidelines of Java

Class Names − The first letter of a class name should be in Upper Case. If the class name has multiple words,
the first letter of each word has to be in Upper Case.
Example: class JavaProgramDemoClass

Case Sensitivity − Java is a case sensitive programming language. Lower and upper case identifiers can have
different meanings. For example, java and Java are different.

Program File Name - A program file’s name has to match a class name. For example, if the class name is
‘JavaDemoExample’, the program file has to be saved as ‘JavaDemoExample.java’.

Method Names - Method names in Java have to start with lowercase letters. If the method name consists of multiple
words, the first letter of each inner word has to be in upper case.
Example - public void myMethodName()

6
Trainer
Manual Core Java

public static void main(String args[]) - Program processing in Java begins from the main () method

Identifier Names - The names used for variables, methods, or classes - should contain numeric characters, alphabetic
characters, connecting characters and currency characters. Identifier names cannot start with a numeric character.

What is a command line argument?

* Command line argument - A command line argument in Java is one that is passed during the time of running a Java
program. The passed arguments can be received in the Java program and utilised as input. The information is stored
in the form of a string array within a main method. The number of command line arguments can be specified by a
programmer.

Addition of two numbers using a command line argument -

public class CommandLineArgument {


public static void main(String args[]){
int num1, num2;
if (args.length > 0) {
try {
num1 = Integer.parseInt(args[0]);
num2 = Integer.parseInt(args[1]);
System.out.println("Sum of inputted numbers = ");
System.out.println(num1 + num2);
} catch (NumberFormatException e) {
System.err.println("Argument must be an integer.");
}
}
}
}

Output:

Sum of inputted numbers = 30

7
Trainer
Manual Core Java

Subtraction of two numbers using a command line argument -

public class CommandLineArgument {


public static void main(String args[]){
int num1, num2;
if (args.length > 0) {
try {
num1 = Integer.parseInt(args[0]);
num2 = Integer.parseInt(args[1]);
System.out.println("Difference of inputted numbers = ");
System.out.println(num1 - num2);
} catch (NumberFormatException e) {
System.err.println("Argument must be an integer.");
}
}
}
}

Output:

Difference of inputted numbers = 10

Practical (30 minutes) - Search, download and install the Eclipse and NetBeans IDE applications on a computer

system.

8
Trainer
Manual Core Java

Instructions: The progress of students will be assessed with the exercises mentioned below.

MCQ

1. IDE stands for Integrated _________ Environment.

a) Decoding

b) Debugging

c) Development

d) none of the mentioned

2. The features of a Java IDE application can be accessed through a graphical ______ interface.

a) installation

b) display

c) user

d) computer

3. Two of the most popular Java IDEs are Eclipse and __________.

a) NetBeans

b) NetScape

c) NetJava

d) NetFrame

4. Can a 32-bit macOS system run Eclipse?

a) Yes

9
Trainer
Manual Core Java

b) No

c) only 64-bit supported

d) does not run on macOS

5. Code completion _______ code writing effort.

a) increases

b) rejects

c) reduces

d) All of the mentioned

6. What is the license of programs created by Eclipse IDE?

a) Eclipse Programming License

b) Eclipse Proprietary License

c) Eclipse Private License

d) Eclipse Public License

7. Which of these programming languages have a similar syntax to Java?

a) C++

b) C

c) Html

d) a and b

10
Trainer
Manual Core Java

8. New Java syntax is introduced with newer versions of Java ___________ Kits.

a) Deployment

b) Development

c) Disintegration

d) None of the mentioned

9. In Java syntax, values are ________.

a) objects

b) tables

c) data arrays

d) None of the above

10. A Java program file name has to match a ______ name.

a) array

b) class

c) function

d) All of the mentioned

11

You might also like