Create a lesson plan for a lesson on data types and variables in Java.
You can assume students have seen a “Hello World” application in Java with explanations of “static void main(String[] args)”, how to run a Java program, etc.
Also assume that students have already learned procedural and object-oriented basics in Python, so the lesson should compare/contrast to Python.
This doesn’t need to be a full written-out lesson, just an outline. Though please do include any code examples you would use.
Context: Basics of Java - Data Types and Variables
Objectives:
- Define the Different Data Types
- Dynamic v. Static Data Types
- Types of Variables
- Variable Declaration
Code Examples and Notes:
Let's remember where we started -- hello world example:
class Main {
public static void main(String[] args) {
System.out.println("hello world");
}
}
Using the skeleton of our class Main
let's print an integer
, a boolean
, and a char
value:
class Main {
public static void main(String[] args) {
System.out.println(7);
System.out.println(true);
System.out.println('A');
}
Using the same structure we can define int
boolean
and char
variables:
class Main {
public static void main(String[] args) {
int favoriteNumber = 3;
boolean justTheTruth = true;
char myScienceGrade = 'B';
}
https://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/