/** * @author lautturi.com * Java example: access a string from another class */ import java.util.*; class Lau { String str="Lautturi"; } public class Lautturi { public static void main(String[] args) { Lau a = new Lau(); System.out.println("string from class Lau:" + a.str); } }
output:
string from class Lau:Lautturi