Java variables are easy! ❎

Pubblicato il: 05 dicembre 2024
sul canale di: Bro Code
133,895
2.8k

#java #javatutorial #javacourse

public class Main {
public static void main(String[] args) {

// ❎ variable = A reusable container for a value.
// A variable behaves as if it was the value it contains.

// 🟥 Primitive = simple value stored directly in memory (stack)
// 🟦 Reference = memory address (stack) that points to the (heap)

// 🟥 Primitive vs 🟦 Reference
// --------- ---------
// int string
// double array
// char object
// boolean

int age = 21;
int year = 2025;
int quantity = 1;

double price = 19.99;
double gpa = 3.5;
double temperature = -12.5;

char grade = 'A';
char symbol = '!';
char currency = '$';

boolean isStudent = true;
boolean forSale = false;
boolean isOnline = true;

String name = "Bro Code";
String food = "pizza";
String email = "fake123@gmail.com";
String car = "Mustang";
String color = "red";

System.out.println("Your choice is a " + color + " " + year + " " + car);
System.out.println("The price is: " + currency + price);

if(forSale){
System.out.println("There is a " + car + " for sale");
}
else{
System.out.println("The " + car + " is not for sale");
}
}
}


In questa pagina del sito puoi guardare il video online Java variables are easy! ❎ della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Bro Code 05 dicembre 2024, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 133,895 volte e gli è piaciuto 2.8 mille spettatori. Buona visione!