Hello, I’ve recently gotten interested in java for making games. I like it because of it’s similarities to c/c++ (I never did get into basic), and it makes oop so much easier to me. Plus the mobile market is still young enough indie developers can still take advantage of it. Anyway I’ve been using “sams teach yourself java2” book to learn from and I’m going through all the excersises to get a better feel for the language. I was trying to calculate percentages from scratch for one excersise, but the program would only give me back zero for the division. Here’s the problem broken down to the nitty-gritty:
public class Percent
{
public static void main(String[] arguments)
{
double percent;
//get the decimal value for 40%
percent = (40/100);
System.out.println(percent);
}
}
Am I missing something? Is this kind of division taboo in java? Any help would be greatly appreciated, thanks for your time.
