Could You Write A Program To Accept A String As A Command Line Parameter And Print Length Of String?
1 Answer - Sort by: Date | Rating
Public class CmdLine {
public static void main(String[] args) {
if (args.length <= 0) {
System.out.printl parameters passed");
} else {
System.out.printl No of parameters passed is " + args.length);
System.out.printl Below is the list of parameters passed along with each Parameters Length **");
for (int i = 0; i < args.length; i++) {
System.out.printl " + i + " : " + args[i]);
System.out.printl Its Length is : " + args[i].length() + "n");
}
}
}
}
public static void main(String[] args) {
if (args.length <= 0) {
System.out.printl parameters passed");
} else {
System.out.printl No of parameters passed is " + args.length);
System.out.printl Below is the list of parameters passed along with each Parameters Length **");
for (int i = 0; i < args.length; i++) {
System.out.printl " + i + " : " + args[i]);
System.out.printl Its Length is : " + args[i].length() + "n");
}
}
}
}
0
0
Again the code vanishes....
Well here u go...
Public class CmdLine {
public static void main(String[] args) {
if (args.length
Well here u go...
Public class CmdLine {
public static void main(String[] args) {
if (args.length
Public class CmdLine {
public static void main(String[] args) {
if (args.length
public static void main(String[] args) {
if (args.length
But the code uses already inbuilt function..........................if already existing functions are to be used then the same program can be written in two lines....
- How The Efficiency And Integrity Of The Data Is Maintained At All Times Although The Database Is Used By Varying Organisational Levels? 2 Examples
- What Is An Attribute In Java?
- How About Links Of London?
- When You Create A New COM Component In Visual Basic, You Choose The Following Template?
- Why Do We Use Public Static Void Main In Java?
- What Parts Of Wordpad?
- What Do You Mean By Index?
- What Is #include?
- What Is Indexed File Organization?
- How The Performance Of Database?
- How Is That The Additional Hardware Affect The Data Base Management System?
- How Do You Automate Starting And Shutting Down Of Databases In Unix?
- How Design An Algorithm For The SIMD Computer To Calculate The Sum Of An Array (A) Of 8 Elements. Assume That Element Ai Is Stored In The Local Memory Of PEi, Where I=1,2,3,.......4?
- Do I Have To Write A Main Method In Every Class I Create?Why?
- Do I Have To Write A Main Method In Every Class I Create?
- What Is Centralize Database Management System?
- Why We Indicate FF As 0FF In Program?
- When To Apply For Css?
- How Do I Enable Java On My I465?
- What Are Key Features Of Procedural Programming?
- What Is Conceptual Methodology?
- What Is Hierarchy Or Structure Of Database?
- Explain How Records And Related Records Are Deleted To Ensure The Integrity?
- I Am Non IT Professionals And Now I Want To Join MS Dynamics CRM. I Learnt Tha C# And ASP.net Is Must For That?
- What Is The Definition Of Hierarchical?
- Program In Java To Accept A String And Find No. Of Characters Present In The String?
- Program In Java To Accept A String And Find The Number Of Blank Spaces In The String?
- Program In Java To Accept A String And Find No. Of Special Character And No. Of Digits?
- What's The Program To Print The Reverse String Of A Given String?

New Comment - Comments are editable for 5 min.