Master the fundamentals of two powerful programming languages through interactive lessons
Learn primitive types, declarations, and type casting
Master if-else, switch, loops (for, while, do-while)
Understand OOP concepts, constructors, and methods
Work with arrays, ArrayLists, and basic data structures
Learn dynamic typing, numbers, strings, and lists
Master if-elif-else, loops (for, while), and range()
Define functions, parameters, return values, and scope
Work with sequences, list comprehensions, and dictionaries
Java is statically typed, meaning you must declare the variable type before using it.
Primitive types include int
, double
,
boolean
, and char
.
// Variable declaration and initialization
int age = 25;
double price = 19.99;
boolean isJavaFun = true;
char grade = 'A';
// Constants (cannot be changed)
final double PI = 3.14159;
Python is dynamically typed - you don't need to declare variable types.
Common types include int
, float
,
bool
, str
, and list
.
# Variable assignment
age = 25
price = 19.99
is_python_fun = True
grade = 'A'
# Constants (by convention, not enforced)
PI = 3.14159
final
keyword, Python uses naming conventions (UPPER_CASE)true
/false
, Python uses True
/False
Fix the variable declarations in this Java code. There are 3 errors to correct.
public class Main { public static void main(String[] args) { // Fix these variable declarations int count = "10"; double average = 3.5 boolean isCorrect = "true"; char initial = A; System.out.println("Count: " + count); } }
Java uses traditional C-style control structures with curly braces {}
.
// If-else statement
int score = 85;
if (score >= 90) {
System.out.println("A");
} else if (score >= 80) {
System.out.println("B");
} else {
System.out.println("C");
}
// For loop
for (int i = 0; i < 5; i++) {
System.out.println(i);
}
// While loop
int count = 0;
while (count < 3) {
System.out.println(count);
count++;
}
Python uses indentation (whitespace) to define code blocks instead of curly braces.
# If-elif-else statement
score = 85
if score >= 90:
print("A")
elif score >= 80:
print("B")
else:
print("C")
# For loop (often used with range())
for i in range(5):
print(i)
# While loop
count = 0
while count < 3:
print(count)
count += 1
Write a Java program that prints numbers from 1 to 100. For multiples of 3 print "Fizz", for multiples of 5 print "Buzz", and for multiples of both print "FizzBuzz".
public class FizzBuzz { public static void main(String[] args) { // Your code here } }
Create a simple calculator that can add, subtract, multiply, and divide two numbers.
Program generates a random number and user tries to guess it with hints.
Store student names and grades, then calculate averages and find highest/lowest.