From ggc
|
01 packagepackage is used to name the directory or folder a class is in intermediate;
02 //start auto-imports
03 importimport means to make the classes and/or packages available in this program java.awt.*;
04 //end auto-imports
05
06
07 /**
08 * All about my application.
09 * @authorthis is the Javadoc tag for documenting who created the source code My Name Here
10 */
11 publicpublic is used to indicate unrestricted access (any other class can have access) classclass is a group of fields and methods used for making objects RationalTest
12 {open braces start code blocks and must be matched with a close brace
13 publicpublic is used to indicate unrestricted access (any other class can have access) staticstatic means that an instance is not required for access (class level access) voidvoid means the method does not return a value mainThe main method is the place where applications begin executing.(String[brackets are typically used to declare, initialize and index (indicate which element of) arrays]brackets are typically used to declare, initialize and index (indicate which element of) arrays args)
14 {open braces start code blocks and must be matched with a close brace
15 Rational rational=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Rational(1, 2);
16 doubledouble is the type for numbers that can contain decimal fractions m=this assignment operator makes the left side equal to the right siderational.getValue();
17 System.out.println("m is "+adds two numbers together or concatenates Strings togetherm);
18 //Point bad=rational.getPair();
19 //bad.y=0;
20 intint is the type for whole numbers and it is short for integer bottom=this assignment operator makes the left side equal to the right siderational.getDenominator();
21 bottom=this assignment operator makes the left side equal to the right side0;
22 m=this assignment operator makes the left side equal to the right siderational.getValue();
23 System.out.println("m is "+adds two numbers together or concatenates Strings togetherm);
24
25 intint is the type for whole numbers and it is short for integer x=this assignment operator makes the left side equal to the right side6;
26 intint is the type for whole numbers and it is short for integer y=this assignment operator makes the left side equal to the right sidex;
27 x=this assignment operator makes the left side equal to the right side5;
28 System.out.println(y);
29
30 System.out.println(Rational.getEpsilon());
31 }close braces end code blocks and must match an earlier open brace
32 }close braces end code blocks and must match an earlier open brace
|
Download/View intermediate/RationalTest.java