I need to know what the constructor is in my programming code

I have 2 java files.

The 1st java file is called pineappples.java

This is the code for pineapples.java

Code :


public class pineapples { public static void main(String args[]){ sushi sushiObject = new sushi("magikarp"); sushiObject.saying(); } }




The 2nd java file is called sushi.java

This is the code for sushi.java

Code :


public class sushi { private String pokemonName; public sushi(String name){ pokemonName=name; } public void setName(String name){ pokemonName=name; } public String getName(){ return pokemonName; } public void saying() { System.out.printf("Your first starter pokemon is %s", getName()); } }






I need to know what the constructor is in my programming code I have 2 java files. The 1st java file is called pineappples.java This is the...

More...