Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java writing an object

class Name{
  private String attributes; //as many attributes as you want  
  Name(){ //no-arg constructor
    //TO-DO stuff
  }  
  public String getAttribute(){
    return attribute;
}

//in another class
public class Main{
  public static void main(String[] args){
    Name name = new Name(); //create object of type Name
   	System.out.println(name.getAttribute()); //prints attribute
  }
}
 
PREVIOUS NEXT
Tagged: #java #writing #object
ADD COMMENT
Topic
Name
8+4 =