my dog learned polymorphism*
The moose likes Beginning Java and the fly likes convert C++ to java?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "convert C++ to java??" Watch "convert C++ to java??" New topic
Author

convert C++ to java??

angela brown
Greenhorn

Joined: Oct 07, 2003
Posts: 4
are there any free programs out there that converts C++ code into java?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Yes and no.
"Yes", there are such programs.
"No", they don't work.


[Jess in Action][AskingGoodQuestions]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
angela missomething,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
angela brown
Greenhorn

Joined: Oct 07, 2003
Posts: 4
sorry, my name is now changed.
thanks for responding people. i don't supposed anyone would want to convert this to java for me, would they? (I've never been taught c++)

[ October 25, 2003: Message edited by: Dirk Schreckmann ]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Well, I can give you some hints.
  • "cout << something" is the same as "System.out.print(something)" in Java.
  • List<string> is a template instantiation, something that current versions of Java don't have (but JDK 1.5 will!) It means a List specialized to hold string objects. You could use a plain java.util.LinkedList .
  • "cin >> something" is a little trickier in Java; it means read "something" from standard input -- i.e., System.in in Java.


  • This program makes use of a template class List<>, which you don't show here; it's not a class from the standard library. The string class is, though.
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: convert C++ to java??
     
    Similar Threads
    CSharp and Java
    whts the out put
    why is 'unsigned' not supported in java
    Apply your Lateral Thinking
    final & private together