Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java get variable from another class

public class Class1 {
	public static String word = "Class1 word";
    
    public Class1() {
    	String class2Word = Class2.word; // Get string "word" from class "Class2".
    }
}

public class Class2 {
	public static String word = "Class2 word";
}
Comment

get variable from another class java

this.variable = otherClassObject.getVariable();
Comment

PREVIOUS NEXT
Code Example
Java :: war file vs jar file 
Java :: pi in java 
Java :: spring boot procfile run profile 
Java :: java array remove space 
Java :: how to hide menu items in android 
Java :: iterator java 
Java :: java loop hashmap 
Java :: sorting the characters in a String in java 
Java :: binding fragment android 
Java :: android create snackbar 
Java :: inline arraylist initialization java 
Java :: java convert string to int array 
Java :: java delete directory with files 
Java :: how to iterate list of string array in java 
Java :: get type java 
Java :: slice a list java 
Java :: java replace all not number 
Java :: static int java 
Java :: hide elements android 
Java :: get average of all the array items android 
Java :: how to make a copy of an array java 
Java :: java 8 find in list by property 
Java :: Java make digit numbers 
Java :: get timezone offset java 
Java :: java install in fedora 
Java :: root to leaf sum leetcode 
Java :: check key is pressed java 
Java :: fileinputstream 
Java :: array java 
Java :: Duration class java 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =