Skip to content

Command Line Argument using Java. #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Command_Line_Argument.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

public class Command_Line_Argument {

public static void main(String[] args) {
// TODO Auto-generated method stub
for(int i = 0;i<args.length;i++) {
System.out.println("args["+i+"]= "+args[i]);
//System.out.println("Welcome");
}
int a = Integer.parseInt(args[0]);
/*
Integer.parseInt is use to typecast String to integer.
Here Integer is a class
*/
System.out.println(a);
float f = Float.parseFloat(args[1]);
System.out.println(f);

double d = Double.parseDouble(args[2]);
System.out.println(d);


}

}