• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

can anyone convert c# code to java code

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


this is a code in c# i want to convert it to java , specially the part where tag from the reader can be read & then printed to PC


[ EJFH: Added code tags. ]
 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look for some online tools that do such jobs or write one in java for yourself!
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sam, welcome to Java Ranch

I once translated a large Java app to C# and the steps I did was to rename the source files, run then through the compiler, and fix the problems that the compiler found. Some things, such as changing System.out.println to Console.WriteLine were easy to accomplish globally by a decent text editor. In one case (generation of an image in memory) I had to completely rewrite the code.

However, Looking at this code, I don't see anything that would be hard to translate to Java by hand. Or were you hoping for someone to do this for you?
 
sam sawant
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the prob is when i converted this code to java is not working with the hardware,
especiallt the read tag function,
so do help me to convert read tag function in java


while reading from a keyboard we use readline() method, so what will be the inbuilt method to read from a hardware.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please post the Java code you have so far. Does your code compile? If you run it, is there and exception? Is so, post the full exception stack trace. If there is no exception, please elaborate on what you mean by "not working with the hardware"

so what will be the inbuilt method to read from a hardware



What hardware? In .NET and Java, input is handled via streams. This is true for keyboard, file, socket, etc. Based on your code, looks you are attempting to read from a socket. Maybe this will help: http://java.sun.com/docs/books/tutorial/networking/sockets/readingWriting.html
 
Rancher
Posts: 280
VI Editor C++ Debian
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Peter Johnson wrote:
I once translated a large Java app to C# and the steps I did was to rename the source files, run then through the compiler, and fix the problems that the compiler found. Some things, such as changing System.out.println to Console.WriteLine were easy to accomplish globally by a decent text editor. In one case (generation of an image in memory) I had to completely rewrite the code.


While I've never undertaken anything quite like this in a long time (I had to rewrite several projects written in VB 6 to C++ some years ago), it is nice to learn that C# and Java are so similar that translating takes no more than changing the file name extension, and make the tweaks suggested by the compiler. Cool.

 
I can't beleive you just said that. Now I need to calm down with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic