Uploaded December 2024 | Updated September 2026, 2 weeks ago
#java #javatutorial #javacourse
// Enhanced switch = A replacement to many else if statements
// (Java14 feature)
#java #javatutorial #javacourse
// Enhanced switch = A replacement to many else if statements
// (Java14 feature)
![Learn POLYMORPHISM in 6 minutes! 🎭
#java #javatutorial #javacourse
public class Main {
public static void main(String[] args) {
// Polymorphism = POLY- = MANY
// -MORPH = SHAPE
// Objects can identify as other objects.
// Objects can be treated as objects of a common superclass.
Car car = new Car();
Bike bike = new Bike();
Boat boat = new Boat();
Vehicle[] vehicles = {car, bike, boat};
for(Vehicle vehicle : vehicles){
vehicle.go();
}
}
}
public abstract class Vehicle {
abstract void go();
}
public class Car extends Vehicle{
@Override
void go(){
System.out.println(You drive the car);
}
}
public class Bike extends Vehicle{
@Override
void go(){
System.out.println(You ride the bike);
}
}
public class Boat extends Vehicle{
@Override
void go(){
System.out.println(You sail the boat);
}
} Learn POLYMORPHISM in 6 minutes! 🎭](https://i.ytimg.com/vi/6xRd0j1anzc/mqdefault.jpg)
![Functions in C are easy! 📞
#coding #programming #cprogramming
void happyBirthday(char name[], int age){
printf(nHappy birthday to you!);
printf(nHappy birthday to you!);
printf(nHappy birthday dear %s!, name);
printf(nHappy birthday to you!);
printf(nYou are %d years old!n, age);
}
int main() {
// function = A reusable section of code that can be invoked called
// Arguments can be sent to a function so that it can use them
char name[50] = ;
int age = 0;
printf(Enter your name: );
fgets(name, sizeof(name), stdin);
name[strlen(name) - 1] = 0;
printf(Enter your age: );
scanf(%d, &age);
happyBirthday(name, age);
return 0;
} Functions in C are easy! 📞](https://i.ytimg.com/vi/7Bq87y7eJEg/mqdefault.jpg)

![Lets code a mad libs game with Java! 📖
#java #javatutorial #javacourse
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// MAD LIBS GAME
Scanner scanner = new Scanner(System.in);
String adjective1;
String noun1;
String adjective2;
String verb1;
String adjective3;
System.out.print(Enter an adjective (description): );
adjective1 = scanner.nextLine();
System.out.print(Enter a noun (animal or person): );
noun1 = scanner.nextLine();
System.out.print(Enter an adjective (description): );
adjective2 = scanner.nextLine();
System.out.print(Enter a verb ending with -ing (action): );
verb1 = scanner.nextLine();
System.out.print(Enter an adjective (description): );
adjective3 = scanner.nextLine();
System.out.println(nToday I went to a + adjective1 + zoo.);
System.out.println(In an exhibit, I saw a + noun1 + .);
System.out.println(noun1 + was + adjective2 + and + verb1 + !);
System.out.println(I was + adjective3 + !);
scanner.close();
}
} Lets code a mad libs game with Java! 📖](https://i.ytimg.com/vi/7QlOxkzFOYw/mqdefault.jpg)



![NumPy aggregate functions are easy! 📊
#coding #python #numpy
import numpy as np
# Aggregate functions = summarize data and typically return a single value
array = np.array([[1, 2, 3, 4, 5],
[6, 7, 8, 9, 10]])
print(np.sum(array)) # Sum of all elements
print(np.mean(array)) # Average of all elements
print(np.std(array)) # Measure of spread
print(np.var(array)) # Square of standard deviation
print(np.min(array)) # Smallest value
print(np.max(array)) # Largest value
print(np.argmin(array)) # Position (flattened) of smallest
print(np.argmax(array)) # Position (flattened) of largest
print(np.sum(array, axis=0)) # sum column-wise (vertically)
print(np.sum(array, axis=1)) # sum row-wise (horizontally) NumPy aggregate functions are easy! 📊](https://i.ytimg.com/vi/8pUBr05OQfs/mqdefault.jpg)

![Learn Java arrays in 9 minutes! 🍎
#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);
}
}
} Learn Java arrays in 9 minutes! 🍎](https://i.ytimg.com/vi/9dr2mHYYoug/mqdefault.jpg)
