To define Global Variable you can make use of static Keyword
public class Example {
public static int a;
public static int b;
}
now you can access a and b from anywhere
by calling
Example.a;
Example.b;
More Related Contents:
- JAVA ArrayIndexoutofBoundException issue
- String replace method is not replacing characters
- Java dynamic array sizes?
- How can I increase the JVM memory? [duplicate]
- Where is JAVA_HOME on macOS Mojave (10.14) to Lion (10.7)?
- Execute another jar in a Java program
- Change the System Brightness Programmatically
- Pipe (|) operator in Java
- Java : parse java source code, extract methods
- Why to use StringBuffer in Java instead of the string concatenation operator
- char and int in Java
- Unable to execute dex: GC overhead limit exceeded in Eclipse
- How to simulate a real mouse click using java?
- load file within a jar
- How to mask credit card numbers in log files with Log4J?
- How to Split a mathematical expression on operators as delimiters, while keeping them in the result?
- Is there any way I can rotate this 90 degrees?
- how to use Spring Boot profiles
- Any implementation of Ordered Set in Java?
- Change output filename prefix for DataFrame.write()
- Enforce not-null field in JSON object
- How to convert IEEE-11073 16-bit SFLOAT to simple float in Java?
- How to change Java version for Maven in IntelliJ?
- How to configure log4j to only keep log files for the last seven days?
- Java-get most common element in a list
- Java charAt used with characters that have two code units
- Java: Timezone why different timezone give same value in millisec
- Creating .p12 truststore with openssl
- maximum size of java class / exception table
- Java Smooth Color Transition