Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Java Question

  Asked By: Hamish    Date: May 08    Category: Java    Views: 624
  

I have very basic question on java.
does anyone know how to read data from the comman line.

for examle in C language
>gcc p1.c
>a.out Test

and we can read use string "Test" so now i am wondering how do we do
that in Java. Any idea.. i really dont know how to do that.

Share: 

 

4 Answers Found

 
Answer #1    Answered By: Cambria Lopez     Answered On: May 08

You need to find a good java  introductory book.

Test.java:

public class Test
{
public static void main(String[] args)
{
for (int i = 0; i < args.length; i++)
System.out.println("Argument " + i + ": " + args[i]);
}
}

 
Answer #2    Answered By: Topaz Ramirez     Answered On: May 08

If you want to learn Java, forget the C or C++, Read any Java book
without comparing with C and you will understand . C is old and not
good realized Language. C can do any things but it isn’t understandable
language.

 
Answer #3    Answered By: Angie Bennett     Answered On: May 08

I don't agree with you at all here. Much of the syntax and structure
in Java was derived from C. So basically anyone that knows C should
be able to learn Java MUCH faster than someone that doesn't know any
language. I coded with C/C++ for many years before learning Java and
I found it to be a fairly smooth transition. The only thing that is
REALLY different is the mindset of OOP.

 
Answer #4    Answered By: Ray Lawrence     Answered On: May 08

I would have to agree, I do mostly Java coding here but on occasion we
do C++ stuff. It all comes down to the best tools for the job, and
sometimes c/c++ is the best tool for the job.

 
Didn't find what you were looking for? Find more on Java Question Or get search suggestion and latest updates.




Tagged: