Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to create a constructor in java

class Other{
    public Other(String message){
        System.out.println(message);
    }
}

class scratch{
    public static void main(String[] args) {
        Other method = new Other("Hey");
        //prints Hey to the console
    }
}
 
PREVIOUS NEXT
Tagged: #create #constructor #java
ADD COMMENT
Topic
Name
2+1 =