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 :: object to string in java 
Java :: java print hex format 
Java :: collections.reverseorder() in java 
Java :: android recyclerview show hide item with animation with default animation 
Java :: how to change image resolution in android programmatically 
Java :: java scanner 
Java :: what is java plug-in 
Java :: len of number in java 
Java :: java random usage 
Java :: android java get current time 
Java :: android check if app is running 
Java :: split every character in string into array java 
Java :: java print variable type 
Java :: convert bytebuffer to string 
Java :: how to call intent in adapter class in android 
Java :: how do i print text in java 
Java :: get request java 
Java :: bootstrap 4 modal get event related target 
Java :: java flowlayout 
Java :: how to print hello world java 
Java :: android studio breakpoint not working 
Java :: unprocessed continuation reference(s) remaining name 
Java :: Java how to make a number without a digit 
Java :: how to solve Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 
Java :: java create map 
Java :: split method in java 
Java :: how to set radio button checked in android programmatically 
Java :: java print array backwards 
Java :: java break 2 for loops 
Java :: java read next line 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =