quinta-feira, 4 de maio de 2017

codigo 04.05.2017 - turma 3

//*******************************************************************
// Dear CompileJava users,
//
// CompileJava has been operating since 2013 completely free. If you
// find this site useful, or would otherwise like to contribute, then
// please consider a donation (link in 'More Info' tab) to support
// development of the new CompileJava website (stay tuned!).
//
// Most sincerely, Z.
//*******************************************************************

import java.lang.Math; // headers MUST be above the first class

// one class needs to have a main() method
public class HelloWorld
{
  // arguments are passed using the text field below this editor
  public static void main(String[] args)
  {
    OtherClass myObject = new OtherClass("Hello World!");
    System.out.print(myObject);
    /**/
    Classe c = new Classe();
    System.out.println (c.acesso()[2].toString());
    
  }
}

public class Classe {
   private OtherClass o = new OtherClass ("Classe");
  OtherClass[] acesso () {
    OtherClass[] array;
    array = new OtherClass[10];
    array[2]= new OtherClass ();
     return array;
  }
  
}

// you can add other public classes to this editor in any order
public class OtherClass
{
  private String message;
  private boolean answer = false;
  public OtherClass () {
    super();
  }
  public OtherClass(String input)
  {
    message = "Why, " + input + " Isn't this something?";
  }
  public String toString()
  {
    return message;
  }
}

Nenhum comentário:

Postar um comentário