Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Visual J# / March 2006

Tip: Looking for answers? Try searching our database.

Can J# accept Sun's Java only?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Indra Bayu - 01 Mar 2006 04:00 GMT
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("jdbc:odbc:TestDatabase");
                    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@hotmail.com
Homer J Simpson - 01 Mar 2006 05:10 GMT
> 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?

> Questions about Visual J# - including the IDE, Java-language syntax, JDK
> functionality, migrating Java-language applications to run on the .NET
[quoted text clipped - 5 lines]
> Thanks,
> Varun

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.