0% found this document useful (0 votes)
1 views6 pages

Java

The document provides an overview of Eclipse IDE, highlighting its features as an integrated development environment for Java, including syntax highlighting, auto-completion, and error detection. It outlines the first-time setup process, the structure of a Java program, data types, user input handling with the Scanner class, and control structures for program flow. Additionally, it explains various Java operators and their applications in programming.
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)
1 views6 pages

Java

The document provides an overview of Eclipse IDE, highlighting its features as an integrated development environment for Java, including syntax highlighting, auto-completion, and error detection. It outlines the first-time setup process, the structure of a Java program, data types, user input handling with the Scanner class, and control structures for program flow. Additionally, it explains various Java operators and their applications in programming.
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/ 6

Eclipse IDE

a. Integrated Development Environment- centralized platform for Java


b. Free & Open-Source- accessible to all developers
c. Comprehensive Toolset- Supports coding, compiling, debugging, and running

First Time Setup in Eclipse


1. Open Eclipse- launch app
2. Select Workspace- choose project directory
3. New Jave Project- Start a new project
4. Add New Class- include main method
5. Start Coding- Begin with java code

Features of Eclipse IDE


a. Syntax Highlighting- Color codes elements for readability
b. Auto-Completion- suggests code snippets
c. Error Detection- Identifies and hightlights syntax error
d. Debugger Tools- helps find and fix logical errors
e. Package Explorer- Organiyes and manages project files

Structure of a Java Program

public class Main {


public static void main (String[] args){
System.out.println(“Hello, World! “);
)
)
class: Blueprint for objects
main: The entry point for program execution
System.out.println: Outputs text to the console

Java Variables and Data Types


int age = 20;
double price = 10.99;
char grade = ‘A’;
String name = “John”;
boolean isPassed = true;

Primitive Data Types


a. Int: Whole numbers
b. double: decimal numbers
c. char: single character
d. bollean: true/false values

Non-Primitive Data Types


a. String: sequence of characters
b. Arrays: collections of similar data
c. objects: instances of classes

Java Input
a. Scanner Class- to get user input
b. Collecting Information
c. Full Name Focus
Scanner Initialization
Scanner input = new Scanner(System.in);

Prompting the User


System.out.println(“Enter your full name: “);

Reading Input
String fullName = input.nextLine();

Displaying Output
System.out.println(“Your full name is: “ + fullName);

1. Apply Scanner Class- for various data types


2. Capture Personal Data- input full name, age, address
3. Display Formatted Output- present collected data clearly

Navigating Program Flow


a. Control Structures- manage the execution order of program statements
b. Operators- perform actions on variables and values

-if statements for conditional execution. Checks if condition is true


-for, while, and do-while loop for repetition
-switch statement for multi-way decisions

if(condition){
// code to execute if condition is true
}

Syntax
int number= 5;
if (number % 2 == 0) {
System.out.println(“Even”);
}else(
System.out.println(“Odd”);
}
Looping Statement- to execute a block of code repeatedly until a condition is false

for loop- ideal when the number of iterations is known beforehand


while loop- condition for repetition is dynamic
do-while loop- gurantees at least one execution
Switch Statement- when checking a variable against multiple constant values

a. Define Java operators- clearly articulate with operators


b. Identify different operator types- distinguish between arithmetic, assignment, comparison and logical
operators
c. Apply operators in Java Programs- demonstrating the correct use of various operators
d. Evaluate expressions using multiple operators- determine the outcome

Operators- special symbols that perform operation


- building blocks for creating expressions
Arithmethic Operators
+ addition
- subraction
* multiplication
/ division
% modulus (remainder)

Assignment operators- used to assign a value to a variable

Comparison Operator
= equal to
≠ not equal to
> greater than
< less than
>= greater than or equal to
<= less than or equal to

Logical Operator
&& AND: both conditions must be true
|| OR: at least one condition must be true
! NOT: Reverses the boolean state of a condition

Unary Operators
+ Unary plus (No effect on positive numbers)
- Unary Minus (negates the value
++ Increment (increases value by 1)
-- Decrement (decreases value by 1)

You might also like