Question
Hello, I have quick question. This is for a Java program. I'm trying to understand global variable in java and goto staements. From my understand
Hello,
I have quick question. This is for a Java program.
I'm trying to understand global variable in java and goto staements. From my understand global variables are define as:
public class Example {
public static int a;
public static int b;
}
can access a and b from anywhere by calling
Example.a;
Example.b;
and goto statement are basically telling a program to goto something.
Im studying this for an exam.
In the following I marked area where I believe is the global variables. Can you please check if I' correct? Sorry I should've been clear.
class iphone extends play
public void run() {
Random = omg new Random();
int wow = 400000;
boolean pay = true; <--- this is a global variable
while(pay) {
int index = unknown.nextInt(readme.size());
System.out.println(readme.get(index));
try {
Thread.sleep(wow); <--- this is a global variable
}catch(Exception e) {
System.out.println("super errors");
check = false; <--- this is a global variable };
}
}
List
iphone(){
readme = new ArrayList
String meme; <--- this is a global variable
Scanner input = null;
String files = "readmee.txt"; --- This is a global variable
try {
input = new Scanner(new File(files));
} catch (FileNotFoundException e) {
System.out.println("files are destory.");
}
while (input.hasNextLine()) {
text = input.nextLine(); --- This is a global variable
readme.add(text); --- This is a global variable }
}
public static void main(String[] args) {
car test = new iphone(); --- This is a global variable car.start();
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started