Uploaded December 2024 | Updated September 2026, 2 weeks ago
#java #javatutorial #javacourse
import java.util.Arrays;
public class Main {
public static void main(String[] args){
// array = a collection of values of the same data type
// * think of it as a variable that can store more than 1 value *
String[] fruits = {"apple", "orange", "banana", "coconut"};
//fruits[0] = "pineapple";
//int numOfFruits = fruits.length;
//Arrays.sort(fruits);
//Arrays.fill(fruits, "pineapple");
for(String fruit : fruits){
System.out.println(fruit);
}
}
}
#java #javatutorial #javacourse
import java.util.Arrays;
public class Main {
public static void main(String[] args){
// array = a collection of values of the same data type
// * think of it as a variable that can store more than 1 value *
String[] fruits = {"apple", "orange", "banana", "coconut"};
//fruits[0] = "pineapple";
//int numOfFruits = fruits.length;
//Arrays.sort(fruits);
//Arrays.fill(fruits, "pineapple");
for(String fruit : fruits){
System.out.println(fruit);
}
}
}








![Lets code a WEIGHT CONVERTER in Java! ๐๏ธ
#java #javatutorial #javacourse
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// WEIGHT CONVERSION PROGRAM
Scanner scanner = new Scanner(System.in);
double weight;
double newWeight;
int choice;
System.out.println(Weight Conversion Program);
System.out.println(1: Convert lbs to kgs);
System.out.println(2: Convert kgs to lbs);
System.out.print(Choose an option: );
choice = scanner.nextInt();
if(choice 1){
System.out.print(Enter the weight in lbs: );
weight = scanner.nextDouble();
newWeight = weight * 0.453592;
System.out.printf(The new weight in kgs is: %.2f, newWeight);
}
else if(choice 2){
System.out.print(Enter the weight in kgs: );
weight = scanner.nextDouble();
newWeight = weight * 2.20462;
System.out.printf(The new weight in lbs is: %.2f, newWeight);
}
else{
System.out.println(That was not a valid choice);
}
scanner.close();
}
} Lets code a WEIGHT CONVERTER in Java! ๐๏ธ](https://i.ytimg.com/vi/DFhpzaEOoxs/mqdefault.jpg)

![Learn Java Object Oriented Programming in 10 minutes! ๐งฑ
#java #javatutorial #javacourse
public class Main {
public static void main(String[] args) {
// Object = An entity that holds data (attributes)
// and can perform actions (methods)
// It is a reference data type
Car car = new Car();
System.out.println(car.make);
System.out.println(car.model);
System.out.println(car.year);
System.out.println(car.price);
System.out.println(car.isRunning);
car.drive();
car.brake();
}
}
public class Car {
String make = Ford;
String model = Mustang;
int year = 2025;
double price = 58000.99;
boolean isRunning = false;
void start(){
isRunning = true;
System.out.println(You start the engine);
}
void stop(){
isRunning = false;
System.out.println(You stop the engine);
}
void drive(){
System.out.println(You drive the + model);
}
void brake(){
System.out.println(You brake the + model);
}
} Learn Java Object Oriented Programming in 10 minutes! ๐งฑ](https://i.ytimg.com/vi/DYbi93vuSaU/mqdefault.jpg)