I'm doing a project for a class and it says to write a program that translates code from one programming language to another. It says that my class containing my static main method should be named "Translate". It should take as input source code of a programming language as a text file with the extension ".x". For example the grader should be able to test using "Translate loop.x" . I can assume that the input file is in the same directory but my question is how do I create a static main method that takes such a parameter. Hope someone can help.
vladdy191
0
Newbie Poster
Recommended Answers
Jump to Postpublic static void main(String [] args) { }
The (String [] args) is the argument of the main. When you call the java program with arguments at the command line those arguments are stored in the args array:
>java Translate arg1 arg2 "arg 3"…
All 3 Replies
javaAddict
900
Nearly a Senior Poster
Team Colleague
Featured Poster
dickersonka
104
Veteran Poster
javaAddict
900
Nearly a Senior Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.