9 Replies - 784 Views - Last Post: 21 April 2009 - 01:28 AM Rate Topic: -----

#1 prajayshetty  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 31
  • View blog
  • Posts: 920
  • Joined: 27-April 07

c# and java

Posted 18 April 2009 - 03:16 PM

hi guys i completed studying c# currently i am studying java i do studied java before but i didnt did it properly but i wanna ask you all 1 question is c# and java brothers and sisters i mean to say are their syntaxes mostly the same with some diffrence
Is This A Good Question/Topic? 0
  • +

Replies To: c# and java

#2 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3101
  • View blog
  • Posts: 19,141
  • Joined: 14-September 07

Re: c# and java

Posted 18 April 2009 - 03:23 PM

That's an accurate statement. I would go further and say all C-style languages are syntactically similar (which is kind of a "duh" given the notion they are all C-style to begin with). It is the nature of being "part of the family".
Was This Post Helpful? 0
  • +
  • -

#3 trixt.er  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 52
  • View blog
  • Posts: 426
  • Joined: 28-September 08

Re: c# and java

Posted 18 April 2009 - 03:28 PM

They are both similar. Java uses all clases. For example main is a class.
import java.io.*;

public static void main (String[] args)
{
   //Run objects here etc.
   System.out.println("What is your name? ");
   //To recieve input do the following.
   BufferedReader br = new BufferedReader(new InputStreamReader
   (System.in));
   String input = br.readLine();
   System.out.print("Welcome to Java " + input " !\n");
}



Generally you will insert the main class inside an object and then call other objects etc... So are you trying to learn Java? Do you have any specific questions?
Was This Post Helpful? 0
  • +
  • -

#4 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: c# and java

Posted 18 April 2009 - 03:54 PM

I believe C# was Microsoft's answer to Java. Supposedly it is a hybrid of Java/C++.
Was This Post Helpful? 0
  • +
  • -

#5 prajayshetty  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 31
  • View blog
  • Posts: 920
  • Joined: 27-April 07

Re: c# and java

Posted 18 April 2009 - 04:31 PM

actually i studied c# but when i started studying java most of them are same i guess the api's might be diffrent in some cases and for both of them i using the same book that i buyed from a book store of same aurthor more or less they are same

the question arrised everytime the aurthor gives some info in the form of notes or remember saying that c/c++/c# same as java in case of some diffrence he points out it thats why i asked


and ya c# is also started becoming platform independent i guess i am right

This post has been edited by prajayshetty: 18 April 2009 - 04:35 PM

Was This Post Helpful? 0
  • +
  • -

#6 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: c# and java

Posted 18 April 2009 - 08:50 PM

View Postprajayshetty, on 18 Apr, 2009 - 03:31 PM, said:

actually i studied c# but when i started studying java most of them are same i guess the api's might be diffrent in some cases and for both of them i using the same book that i buyed from a book store of same aurthor more or less they are same

the question arrised everytime the aurthor gives some info in the form of notes or remember saying that c/c++/c# same as java in case of some diffrence he points out it thats why i asked


and ya c# is also started becoming platform independent i guess i am right


C# was made as part of the .NET Framework so it would run on any machine that uses the .NET Framework. Java was designed so that it would run on any computer that had Java installed on it. Yes, I'm just starting to learn Java and the syntax is very similar. You are right, the .NET Framework and the Java libraries are different.
Was This Post Helpful? 0
  • +
  • -

#7 fremgenc  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 119
  • Joined: 15-November 07

Re: c# and java

Posted 18 April 2009 - 10:02 PM

you can honestly copy paste code from either language and allow it to compile by changing a few lines of code.

There is actually a program that converts java<->C#.

point being- they are very similar
Was This Post Helpful? 0
  • +
  • -

#8 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 774
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Re: c# and java

Posted 18 April 2009 - 11:51 PM

Quote

you can honestly copy paste code from either language and allow it to compile by changing a few lines of code.


I would say that I disagree with this statement. The main problem is that many languages are based on a different set of libraries. Add a different syntax and the way control structures are built, and this shows that the copy/paste method in this case won't work.

Yes, there are code convertors, however their efficiency is only acceptable when working with very small projects. When it comes to a larger scale type of applications that are based on hundreds of code files, code converters are not very reliable.
Was This Post Helpful? 0
  • +
  • -

#9 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5800
  • View blog
  • Posts: 12,636
  • Joined: 16-October 07

Re: c# and java

Posted 19 April 2009 - 02:41 AM

C# is basically Microsoft's Java. When C# came out, they were even closer than they are now. They even function the same, "compiling" to p-code, running on top of interpretors virtual machines. Using no libraries, you can write code that will run the same in both.

It's the "frameworks" that make the language. Java has it's set of libraries and C# has it's set, called the .NET framework. These are not portable across languages. Though, of course, there is inevitable overlap of functionality.

Essentially, a Java programmer moving to C# need only learn the framework, they already understand the language. There are some lower level gotchas, like how primitives are handled, but that's a case by case kind of thing.

I usually explain C# as Microsoft's Java with the benefit of hind site.
Was This Post Helpful? 0
  • +
  • -

#10 prajayshetty  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 31
  • View blog
  • Posts: 920
  • Joined: 27-April 07

Re: c# and java

Posted 21 April 2009 - 01:28 AM

ya i agree on your statement c# as microsoft's java
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1