1 / 5

Chapter 6 Methods

Chapter 6 Methods. Passing Parameters. public static void nPrintln (String message, int n) { for ( int i = 0; i < n; i ++) System.out.println (message); }. Suppose you invoke the method using nPrintln(“Welcome to Java”, 5); What is the output?

dfrost
Download Presentation

Chapter 6 Methods

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 6 Methods

  2. Passing Parameters public static void nPrintln(String message, int n) { for (inti = 0; i < n; i++) System.out.println(message); } Suppose you invoke the method using nPrintln(“Welcome to Java”, 5); What is the output? Suppose you invoke the method using nPrintln(“Computer Science”, 15); What is the output? Can you invoke the method using nPrintln(15, “Computer Science”);

  3. TestPassByValue.java Page 213 Listing 6.5 Increment Run

  4. GreatestCommonDivisorMethod.java • Pages 215-6 Listing 6.6

  5. PrimeNumberMethod.java • Pages 216-7 Listing 6.7

More Related