Lynk Library of Knowledge

9496 Lynk's site for housing knowledge and information for the team.


Project maintained by LynkRobotics Hosted on GitHub Pages — Theme by Jimmy McCosker

Division




Example

//Anything typed after a "//" is comment, the complier ignores comments
//Comments are used to provide more information about what a program is doing.

public class JavaIntro {                        //This creates the "class", for now think of each class like a document or file
    public static void main(String args[]) {    //This line lets Java know what to run when you click execute below
      int x = 10;
      int y = 20;
      int answer = x / y;

      System.out.println("Answer: " + answer);
    }                                           //End of main
}                                               //End of JavaIntro


Output: 0


Since int can’t have decimals, the answer is 0 instead of 0.5



Previous Page / Home / Next Page