classes and creating objects
Create a Dice class that has a face data field (that indicates the current value showing). The class should have a getFace method which returns the current value of face, and a roll method that chooses a random value for face. Write a main program that creates 2 Dice objects. The main program should roll both dice and display the value showing for each. Be sure to use proper style. Create a jar file of your program and attach to this assignment page.
This is what I have:
Is this correct?
public class Dice
int face = 6;
// returns the current value of face
return 1 + (int)(Math.random() * 7);
public class diceGame
public static void main(String args)
Dice dice1 = new Dice();
System.out.println("dice1 is " + dice1.getFace());
Dice dice2 = new Dice();
System.out.println("dice2 is " + dice2.roll());