I have encountered these 2 errors doing the unit 6 game zone involving PigDiceGame.java, what do i need to change?
jGRASP exec: javac -g PigDiceGame.java
PigDiceGame.java:16: error: cannot find symbol
Die newDie = new Die();
^
symbol: class Die
location: class PigDiceGame
PigDiceGame.java:16: error: cannot find symbol
Die newDie = new Die();
^
symbol: class Die
location: class PigDiceGame
2 errors
Solution : -
When external classes or interfaces is used in the current program
you need to import those classes (that can be user defined or
built-in) in your current program using the import keyword, But
when program gives Cannot find symbol error it may
be due to below reasons,
1) If the path of class or interface imported are not available to
Java Virtual Machine (JVM).
2) If the absolute class name mentioned in import statement is not
correct (i.e, packages name, class name).
3) If not imported the class or interface used.
Your program not identifing Die as a class so it is giving error as Cannot find symbol.
To make it working try after including below lines of code to
the program
package dieGames;
import javax.swing.JOptionPane;
===========================END======================================
comment if any query.
Get Answers For Free
Most questions answered within 1 hours.