CIS 790 JAVA Distance Education QUIZ -03

Prof. Auciello's Virtual Classroom Quiz

9 - 11 class = Section 0175

Last.First Name:

 

Q001: CIS 790 QUIZ 03 PROF. AUCIELLO TOPICS: 1. JAVA APPLICATION (DOS) VS APPLET (WEB) 2. DEFINE class, public, void, main, String args[] 3. for loop 4. post incrementing 5. compiling, testing 6. concatenation operator (+) [links data types together] YOU MAY WANT TO DOWNLOAD AND READ "33 STEPS TO COMPILING A JAVA PROGRAM" (LISTED ON THE JAVA PAGE). // THIS APPLICATION WAS COMPILED IN A JDK1.3 ENVIRONMENT. // IF YOU NEED TO, SEE INSTRUCTOR TO RUN YOUR PROGRAM // UNDER JDK1.3 1) USING THE CODE BELOW, WRITE A PROGRAM THAT GIVES THE FOLLOWING OUTPUT: Hello World, 1 Hello World, 2 Hello World, 3 Hello World, 4 Hello World, 5 Hello World, 6 Hello World, 7 Hello World, 8 Hello World, 9 Hello World, 10 } // ends class { System.out.println("Hello World, " + x); } class q3790 { for (int x = 1; x < 11; x++) { public static void main (String args[]) } // ends for-loop structure (100 points) Put this code in order. make it work. ======================================================= 2) (100 points) Explain every line of code to the following level of detail: { public static void main (String args[]) // String args[] is an array of String // type (used for command line parameters) // main = main method (procedure) // "void" does not return a result // "static" means this method is associatd with a class // not a object (more later) // "public" (keyword that controls access to this code.) // "public" means available to other programs in same workspace. // "private" = not available to program-at-large. Source of information: 21 DAYS TO JAVA PROGRAMMING -- LAURA LeMAY ================================================================== WHEN YOU ANSWER THIS QUIZ, PASTE IN THE CORRECT JAVA CODE THAT YOU HAVE TESTED, AND TAKE EACH LINE OF CODE AND COMMENT ON IT, AS I DID ABOVE. THIS IS NOT JUST A QUIZ. IT IS A ONLINE CLASS DISCUSSION OF WHAT MAKES THIS PROGRAM WORK. KEEP STUDYING IT, READING MY ANSWERS AND THE ANSWERS OF OTHERS UNTIL YOU UNDERSTAND IT CLEARLY. THIS IS NOT JUST A QUIZ, IT IS AN INTERACTIVE FORUM, WHERE BY READING THE ANSWERS OF OTHERS, YOU CAN PICK UP HINTS FOR SOURCE INFORMATION, AND BRING YOURSELF TO THE NECESSARY LEVEL OF UNDERSTANDING. THE LAST LINE OF YOUR ANSWER SHOULD BE -- "I GOT IT, MR. A" -- I UNDERSTAND IT! . (keep digging for information, keep testing and recompiling code, intentionally making errors to understand the error messages.) Keep at it until you dominate this program!