This repository serves as a personal collection of Java code examples, exercises, and fundamental programs created while learning core concepts and algorithms.
| File Name | Description |
|---|---|
OddEven.java |
Checks if a user-input number is odd or even. |
simpleinterest.java |
Calculates simple interest after prompting the user for Principal, Rate, and Time. |
temperature.java |
Prompts the user to enter a temperature in Celsius, converts that value to Fahrenheit and displays the converted temperature. |
Calculator.java |
Implements a basic command-line calculator that allows a user to perform repetitive arithmetic operations (+, −, ∗, /, %) on two integer inputs. The program runs in a loop until the user enters 'x' or 'X' to exit. |
Largest.java |
This Java program takes three integer inputs from the user and determines which number is the largest among them. It also demonstrates two different approaches to solving the same problem. |
fibonacci.java |
A Java program that generates and displays the Fibonacci series up to a user-specified number of terms. |
CountNums.java |
This program counts how many times a specific digit appears in a given integer. You can change both the input number and the digit to be counted in the code, and the program will display how many times that digit occurs in the number. |
Casecheck.java |
This Java program takes a single character as input from the user and determines whether it is an uppercase or lowercase English alphabet letter. It uses conditional statements to compare the character’s ASCII values within the ranges of uppercase ('A'–'Z') and lowercase ('a'–'z'). |
greatestnumber.java |
A Java program that takes two numbers as input and prints which one is greater, smaller, or if both are equal using conditional statements and Math.max()/Math.min() functions. |
ArrayExamples.java |
Demonstrates basic array operations: user input, printing, sorting, and filling an array using java.util.Arrays. |
ChangeValue.java |
Illustrates how a method can change the values of an array passed as an argument (pass-by-reference effect in Java). |
Greeting.java |
A simple program demonstrating how to call a method (greeting) from a different class (Methodsss). |
IsPrime.java |
Contains a method (isPrime) to check if a user-provided integer is a prime number. |
isArmstrong.java |
Contains a method (isArmstrong) to check if a number is an Armstrong number and prints all Armstrong numbers from 1 to 10,000. |
Methodsss.java |
Contains various methods (sum, greeting, sum2) to demonstrate method definition and calling with and without parameters. |
OverLoading.java |
Demonstrates method overloading in Java with two versions of method A and two versions of method B (different parameter lists). |
shadowing.java |
Illustrates the concept of variable shadowing, where a local variable hides a class-level static variable with the same name. |
StringExample.java |
Demonstrates user input using Scanner and passing a String as a parameter to a method for simple greeting construction. |
Swap.java |
Contains a method (swap) to swap the values of two integer variables using a temporary variable. |
VarAgrs.java |
Demonstrates the use of Variable Arguments (Varargs) in Java methods (...) to pass a variable number of arguments. Includes examples using int, String, char, and the universal Object type. |
AreaOfCircle.java |
Calculates the area of a circle based on user-provided radius. |
AreaOfRectangle.java |
Calculates the area of a rectangle based on user-provided length and width. |
AreaOfTriangle.java |
Calculates the area of a triangle using user-provided base and height. |
LCM.java |
This Java program calculates the Least Common Multiple (LCM) of two numbers entered by the user. |
EquilateralTriangle.java |
Calculates the area of an equilateral triangle using user-provided length of one side. |
IsoscelesTriangle.java |
Calculates the area of an isosceles triangle using user-provided base and height. |
Parallelogram.java |
Calculates the area of a parallelogram using user-input values of the equal sides and base. |
Rhombus.java |
Calculates the area of a rhombus using the user-provided lengths of its two diagonals. |