Answers for ""@Scope" java"

1

scope java

public class example{
	// A variable here is visible through the entire class. Every single method
    // in this program can see and modify the variable
    
	public static void main(String[] args){
    	// A variable here is only defined in main, therefore no other methods 
        // can access or modify the variable
        
    for(){
    	// A variable here is only visible in the for loop, and no other part
        // of the program may access this variable
    }// for
    
    }// main
}// class

As seen by the examples above, where you put the variable will matter as to 
what can access, view and modify the variable, which is defined as scope
Posted by: Guest on October-18-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language