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 :: loop through string in java 
::  
::  
::  
Javascript ::  
::  
Javascript :: get jquery version from console 
::  
::  
::  
::  
Javascript ::  
Javascript ::  
::  
::  
::  
::  
::  
::  
::  
::  
::  
Javascript ::  
::  
Javascript ::  
Javascript ::  
Javascript :: updating node js ubuntu 
::  
::  
ADD CONTENT
Topic
Content
Source link
Name
7+6 =