Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Complete the application below and answer the following questions:
/** Print a friendly greeting. */
2 public static void main(String[] args) {
3 int index;
4 for(index = 0; index < args.lenght; index = index + 1) {
5 System.out.println("Hello, " + args[index] + "!");
6 }
7 }
Question:
1. What is the scope of index in the application?
2. Using this kind of loop, print the numbers 1 trough 10.

could u be more specific? dere are mistakes within the code only. like it should be args.length
for printing no.s from 1 to 10 use for loop:
for(int i=1; i<=10;i++)
System.out.println("Number:"+i);

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |