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 :: java using the segment Information already before the for-loop 
Java :: java remove element from list 
Java :: JAXRS EXCEPTION MAPPER 
Java :: Custom Layout to listview 
Java :: shuffle a string in java 
Java :: spring media part max size 
Java :: room ktx dependency 
Java :: Java remove element in a array - set to null 
Java :: Java Private Access Modifier Error when we call it 
Java :: place.getlatlng() returning null 
Java :: Rotate array to left k cells python 
Java :: how to sort a collection using stream 
Java :: java spigot string to kyori textcomponent 
Java :: How To Export Records From JTable To MS Excel 
Java :: activity selection java solution 
Java :: sorting boolean array with prime index 
Java :: How to Implement GET and POST Requests With Java 
Java :: Java labeled break Statement 
Java :: java data table source tymeLeaf 
Java :: android conditional api level 
Java :: 1 2 1 3 2 1 4 3 2 1 3 2 1 2 1 1 java 
Java :: Android equivalent of getElementById 
Java :: 111111000 
Java :: how to load template file from resource folder in spring boot project 
Java :: ChangeElementsOfHashMap 
Java :: how to get map with string as key and Arraylist as value in java 
Java :: What is sleep() method 
Java :: integer class in java 
Java :: setting up javafx in eclipse 
Java :: how to use a switch statement in java 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =