HighTechTalks DotNet Forums  

Can J# accept Sun's Java only?

Dotnet VJSharp microsoft.public.dotnet.vjsharp


Discuss Can J# accept Sun's Java only? in the Dotnet VJSharp forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Indra Bayu
 
Posts: n/a

Default Can J# accept Sun's Java only? - 02-28-2006 , 11:00 PM






Hi, I'm in crisis for my final task.

First, can J# accept/filter only Sun's Java code?
I mean, J# has delegate, events, blablabla, while Java can't.
Can J# filter those?

Second, J# is somehow a little different compared to Java.
For example, it doesn't overload the conn.createStatement() method,
which is overloaded by Java.
I mean, how can I convert existing Java code(which takes parameters) to J#
code (which takes no parameters)?

Here's a sample J# code that wouldn't compile in Java:

import java.sql.*;

public class Test
{
public static void main(String [] args) throws Exception
{
try
{

Class.forName("com.ms.jdbc.odbc.JdbcOdbcDriver");//RunTime error-1
Connection conn =
DriverManager.getConnection("jdbcdbc:TestDatabas e");
Statement stt = conn.createStatement();//Compile error-1
try
{
stt.executeUpdate("Create Table t (primaryKey int
Primary key)");
}
catch(Exception err)
{
//the table already exist
}
/* Read all rows and columns*/
ResultSet rs = stt.executeQuery("Select * from t");
while (rs.next())
{
myPrint(rs.getObject(1));//RunTime error-2
}
System.in.read();
}
catch(Exception err)
{
myPrint("Error occured!!!");
err.printStackTrace();
System.in.read();
}
}

public static void myPrint(Object message)
{
System.out.println(message.toString());
}
}

Please help me!
Any library, code, or link is going to be appreciated.
If my explanation is not clear, you can tell it to csharpindonesia (AT) hotmail (DOT) com


Reply With Quote
  #2  
Old   
Homer J Simpson
 
Posts: n/a

Default Re: Can J# accept Sun's Java only? - 03-01-2006 , 12:10 AM







"Indra Bayu" <Indra Bayu (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi, I'm in crisis for my final task.

First, can J# accept/filter only Sun's Java code?
I mean, J# has delegate, events, blablabla, while Java can't.
Can J# filter those?

"Varun Gupta" <VarunGupta (AT) discussions (DOT) microsoft.com> wrote

Quote:
Questions about Visual J# - including the IDE, Java-language syntax, JDK
functionality, migrating Java-language applications to run on the .NET
Framework, and more.

Please post here -
http://forums.microsoft.com/MSDN/Sho...ID=28&SiteID=1

Thanks,
Varun



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.