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 readme ;

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!