your teacher is right. what he/she wants you to create is a Dice class. in your case, you have created a simple program (with main method) which is capable of printing a random number of dice.
Here is example of what he/she wants:
public class Dice { public int numberShowing() { // do some stuff here if necessary before return statement // return the random generated dice } public void roll() { /* do some stuff here like generating a random numbers from 1 - 6 */ } } then test that Dice class
public class TestDice { public static void main(String[] args) { Dice dice = new Dice(); // creating an object and reference variable of the object created // do some stuff here like rolling the dice } } TestDice class is just a testing class to make sure that the
Dice class works perfectly.