Class Notes for Methods |
|
Create a class called MoreMethods
- in the main class be sure to test all your methods you make.
1. Create a method (called PrintThis) that has a String parameter called s and an int parameter called x. The return type is void. This method should use a for loop to print the String parameter x number of times.
2. Write a method named printNameAddressCityState that will print out your name, address, and city/state. The return type is void. Your name should appear on the first line, you address on the second line, and your city/state on the last line.
3. Create a method called underline. This method has one int parameter length. This method should print the underscore character '_' length number of times on one line. (hint: use a loop and the System.out.print() statement)
- in the main class be sure to test all your methods you make.
1. Create a method (called PrintThis) that has a String parameter called s and an int parameter called x. The return type is void. This method should use a for loop to print the String parameter x number of times.
2. Write a method named printNameAddressCityState that will print out your name, address, and city/state. The return type is void. Your name should appear on the first line, you address on the second line, and your city/state on the last line.
3. Create a method called underline. This method has one int parameter length. This method should print the underscore character '_' length number of times on one line. (hint: use a loop and the System.out.print() statement)
Videos |
|