Uploaded December 2024 | Updated September 2026, 2 weeks ago
#java #javatutorial #javacourse
public class Main {
public static void main(String[] args) {
// Composition = Represents a "part-of" relationship between objects.
// For example, an Engine is "part of" a Car.
// Allows complex objects to be constructed from smaller objects.
Car car = new Car("Corvette", 2025, "V8");
System.out.println(car.model);
System.out.println(car.year);
System.out.println(car.engine.type);
car.start();
}
}
public class Car {
String model;
int year;
Engine engine;
Car(String model, int year, String engineType){
this.model = model;
this.year = year;
this.engine = new Engine(engineType);
}
void start(){
this.engine.start();
System.out.println("The " + this.model + " is running");
}
}
public class Engine {
String type;
Engine(String type){
this.type = type;
}
void start(){
System.out.println("You start the " + this.type + " engine");
}
}
#java #javatutorial #javacourse
public class Main {
public static void main(String[] args) {
// Composition = Represents a "part-of" relationship between objects.
// For example, an Engine is "part of" a Car.
// Allows complex objects to be constructed from smaller objects.
Car car = new Car("Corvette", 2025, "V8");
System.out.println(car.model);
System.out.println(car.year);
System.out.println(car.engine.type);
car.start();
}
}
public class Car {
String model;
int year;
Engine engine;
Car(String model, int year, String engineType){
this.model = model;
this.year = year;
this.engine = new Engine(engineType);
}
void start(){
this.engine.start();
System.out.println("The " + this.model + " is running");
}
}
public class Engine {
String type;
Engine(String type){
this.type = type;
}
void start(){
System.out.println("You start the " + this.type + " engine");
}
}
![Slicing in NumPy is easy! ✂️
#coding #numpy #python
Slicing in NumPy allows you to extract portions of an array using a [start:stop:step] syntax. It works similarly to Python lists but is more powerful, especially for multi-dimensional arrays.
00:00:00 row slicing
00:05:08 column slicing
00:08:38 row & column slicing Slicing in NumPy is easy! ✂️](https://i.ytimg.com/vi/6WaBryk4fkE/mqdefault.jpg)
![While loops in C are easy! ♾️
#coding #programming #cprogramming
// while loop = Continue some code WHILE the condition remains true
// Condition must be true for us to enter while loop
// EXAMPLE 2
char name[50] = ;
printf(Enter your name: );
fgets(name, sizeof(name), stdin);
name[strlen(name) - 1] = 0;
while (strlen(name) 0) {
printf(Name cannot be empty! Please enter your name: );
fgets(name, sizeof(name), stdin);
name[strlen(name) - 1] = 0;
}
printf(Hello %s!, name);
// EXAMPLE 3
bool isRunning = true;
char response = 0;
while(isRunning){
printf(You are playing a gamen);
printf(Would you like to continue? (Y = yes, N = no): );
scanf( %c, &response); // remove n from input buffer
if(response != Y && response != y){
isRunning = false;
}
}
printf(You exit the game);
return 0; While loops in C are easy! ♾️](https://i.ytimg.com/vi/6YNYuJ_jiu0/mqdefault.jpg)

![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)