Java: print field in an image of other class?

Posted by HH on Stack Overflow See other posts from Stack Overflow or by HH
Published on 2010-04-03T19:44:51Z Indexed on 2010/04/03 19:53 UTC
Read the original article Hit count: 269

Filed under:
|
|

DirectoryReader.java

public class DirectoryReader {
   public static void main(String[] args) {
      File myFile = new File(path);
      FileObject fileThing = new FileObject(myFile);

      //How to print the value of the hello-field from fileThing?

   }
}

FileObject.java

public class FileObject {

   FileObject (File fileThing) {
       String hello = "Hello Cosmos!";
   }
}

© Stack Overflow or respective owner

Related posts about java

Related posts about beginner