Exercise 3: Write a Java program to declare two integer variables, one float variable, and one string variable and assign 10, 12.5, and "Java programming" to them respectively. Then display their values on the screen.
Solution:
accessVariables();
}
void accessVariables() {
int x = 10;
float y = 12.5;
String s = "Java programming";
println(x);
println(y);
println(s);
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น