Skip to content

Latest commit

 

History

History
35 lines (27 loc) · 1.21 KB

README.md

File metadata and controls

35 lines (27 loc) · 1.21 KB

Java Learning Codes

Beginner-friendly Java programs, starting from the basics.

Basic Programs

  1. HelloWorld.java — print a message
  2. Variables.java — declare and display variables
  3. UserInput.java — read input with Scanner
  4. EvenOdd.java — check whether a number is even or odd
  5. AgeCheckForVote.java — check voting eligibility by age
  6. MultiplicationTable.java — print a multiplication table using a method
  7. PositiveNegativeZero.java — classify a number using conditions
  8. Calculator.java — perform arithmetic on two user-entered numbers
  9. FahrenheitToCelsius.java — convert Fahrenheit to Celsius
  10. StudentInfo.java — display student information
  11. StudentGradeCalculator.java — calculate total, percentage, grade, and pass/fail result
  12. ClassAndObjectDemo.java — demonstrate a class and two objects
  13. ArrayAverage.java — calculate the average of numbers stored in an array

Run a Program

javac basic/HelloWorld.java
java -cp basic HelloWorld

To run the grade calculator:

javac basic/StudentGradeCalculator.java
java -cp basic StudentGradeCalculator

Each file contains one public class. The filename and class name must match.