Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Java's args.length

Posted on 1998-07-14
5
Medium Priority
?
1,896 Views
Last Modified: 2006-11-17
if I give *  as a an argument in command line for a java program, why args.length returns 268? and not 1
ex:
java myProgram *
args.length returns 268??? and not 1

can any body tell me ???? please

I use 1.2beta3 JDK on Windows 95
0
Comment
Question by:hvhemant
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 5

Expert Comment

by:msmolyak
ID: 1226355
Can't see why it should. Could you supply a code sample.
0
 

Author Comment

by:hvhemant
ID: 1226356
msmolyak,
here is the simple code

class Test{
   public static void main(String args[]){
      System.out.println(args.length());
    }
}
0
 

Author Comment

by:hvhemant
ID: 1226357
msmolyak,
     here is the simple code please ignore the above sample code.

class Test{
        public static void main(String args[]){
           System.out.println(args.length);
         }
     }
0
 

Author Comment

by:hvhemant
ID: 1226358
Edited text of question
0
 
LVL 5

Accepted Solution

by:
msmolyak earned 100 total points
ID: 1226359
Apparently asterisk gets treatead as a wild card so the args array gets populated with the names of the files matching the pattern. I am not sure whether it is a standard feature of JVM. I tried the same in Symantec and it does not seem to do it.

If you want to pass an asterisk, use "*".
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This video teaches viewers about errors in exception handling.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question