Java, symbol error not found?
•
Java
I tried to calculate the total price of unit price 17 and the quantity of goods 20
public class hw1_task3 {
public static void main(String[] args) {
int total = units * price;
int units = 20;
int price = 17;
System.out.printf("The total is: %d",total);
}
}
What's wrong with the plan? I've been getting an error about not being able to find symbols I am a novice in Java. Thank you very much for any help
Solution
You need to move units and prices above the total as follows:
int price = 17; int units = 20; int total = units * price;
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
