My First Java Project
Description
This is a simple Java program that prints "Hello GitHUb!".
-
Compile the program: javac hello.java
-
Run the program: java hello
- Java
๐งช Day 1: Java Datatypes Practice
๐ Program: Mydetails.java
This program demonstrates the use of different Java datatypes by storing and printing personal details.
- String โ Name
- int โ Age
- byte โ Number of siblings
- long โ Phone number
- float โ Height
- double โ Weight
- boolean โ Student status
The program prints formatted personal information using different datatypes.
- Understood primitive and non-primitive datatypes
- Learned how to store and display values
- Practiced basic Java syntax and structure
๐งฎ Java Operators Program
๐ Overview
This project is a simple Java program that demonstrates the use of basic arithmetic operators. It performs operations on two integer variables and prints the results.
๐ป Language Used Java
๐ Program Description The program:
Declares two integer variables a and b Performs different arithmetic operations Prints the results to the console ๐ข Operators Used Addition (+) Subtraction (-) Multiplication (*) Division (/) Modulus (%)
Save the file as:
operators.java
Open terminal and compile:
javac operators.java
Run the program:
java operators ๐ Output sum: 30 8 80 0 10 ๐ฏ Learning Objective Understand how arithmetic operators work in Java Learn integer division and modulus behavior Practice writing and running basic Java programs ๐ค Author
Ranjitha N
This is a simple Java program that checks whether a person is eligible to vote using basic if conditions.
The program takes a person's age as input and determines if they are allowed to vote or not. If the age is 18 or above, the person is eligible to vote. Otherwise, they are not eligible.
- Uses simple
ifcondition - Easy to understand logic
- Beginner-friendly program
- Java
-
Enter age
-
Program checks condition:
- If age โฅ 18 โ Eligible to vote
- Else โ Not eligible
Ranjitha N
This is a simple Java program that checks whether a person is eligible to vote based on their age using conditional statements.
- Uses basic
if-elsecondition - Beginner-friendly Java program
- Demonstrates decision-making logic
- If age is greater than or equal to 18 โ Eligible to vote
- Otherwise โ Not eligible to vote
class Result {
public static void main(String[] args) {
int age = 20;
if (age >= 18) {
System.out.println("The person is eligible to vote");
} else {
System.out.println("The person is not eligible to vote");
}
}
}-
Save the file as
Result.java -
Open terminal in the file location
-
Compile the program:
javac Result.java -
Run the program:
java result
The person is eligible to vote
- Java
This project is created as part of learning Java fundamentals and improving programming logic for coding interviews.
This is a simple Java program that checks whether a student is eligible for a scholarship based on their income.
The program takes a fixed income value and uses an if-else condition to determine eligibility.
- If income is greater than 7000 โ Scholarship Available
- Otherwise โ Not eligible for scholarship
- Java
- Basic If-Else Statement
-
Compile the program: javac Income.java
-
Run the program: java Income
Not eligible for scholarship
This program is useful for beginners to understand:
- Conditional statements in Java
- Basic program structure
This is a simple Java program that checks whether a number is divisible by both 3 and 5 using nested if statements.
The program initializes a number and checks:
- If the number is divisible by 3
- Then it checks if the number is also divisible by 5
If both conditions are satisfied, it prints that the number is divisible by both 3 and 5.
- Java
- Nested If-Else Statements
-
Compile the program: javac Divisible.java
-
Run the program: java Divisible
Number is divisible by both 3 and 5
The current program only prints output when the number is divisible by both 3 and 5. If the number is divisible by 3 but not by 5, no output will be shown.
This program helps beginners understand:
- Nested if conditions
- Modulus operator (
%) - Logical checking in Java