Computing.Net > Forums > Programming > Java problem

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Java problem

Reply to Message Icon

Name: capoeira26
Date: September 23, 2009 at 13:56:33 Pacific
OS: Windows Vista
Product: Sony Vaio nw 15.5 2.0 ghz notebook - silver
Subcategory: Java
Tags: Java netbeans
Comment:

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.



Sponsored Link
Ads by Google

Response Number 1
Name: somjeet
Date: October 9, 2009 at 07:43:37 Pacific
Reply:

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);


0
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Java problem

java problem www.computing.net/answers/programming/java-problem/11363.html

Java Problem www.computing.net/answers/programming/java-problem/7796.html

RealJ for Java (problem compiling) www.computing.net/answers/programming/realj-for-java-problem-compiling/1900.html