Java Overview for a C# Guy

Posted on 2006-03-22
Last Modified: 2013-11-23
I've been a C# developer for 3 years and I'm very proficient.  I've just changed jobs and have moved into a Java shop.  I have absolutely no problem reading and understanding Java Code.  

I am looking for a detailed description of the mechanics of Java and JSP from a developers standpoint, ideally, to help make the transition from C# to Java.

For example...

When I compile my C# app, the classes get compiled into a DLL in the bin folder.  Simple enough.  What happens when I compile a Java app? Also, when I make a change to an ASPX page in ASP.NET, the change is immediate without the need to rebuild.  Is this case for Java or do I need to recompile?  And what the hell is a BEAN and how do I use it?

Basically, I am looking for as many of the differences (and similarities) to get me off to a good start.  I understand there will be a learning curve as I familiarize myself with Java objects, but right now, my biggest hurdle is that I don't yet understand the BIG picture in how all the pieces fit together.

Thanks in advance...500 PTS
Question by:mmarksbury
    LVL 32

    Accepted Solution

    Having worked with both, there is almost a direct relationship and amazing similarities between the C#/ASP.NET and the Java/JSP environments.  Since you already understand the concepts behind both, you should have no trouble apart from what I consider to be very annoying aspects of the Java language.  In my view, C# is what Java would have been if it hadn't been developed by "purists" who appreciate the "beauty" of a language rather than its utility.  If "beauty" is so great, why is Pascal an eternal also-ran??

    >>When I compile my C# app, the classes get compiled into a DLL in the bin folder

    That would only be due to the fact that you've chosen to build DLLs and not applications, i.e. EXE file.

    >>Also, when I make a change to an ASPX page in ASP.NET, the change is immediate without the need to rebuild

    Not the case...  The JIT compiler re-compiles the updated ASPX page the first time it's accessed.  JSP is almost identical in its approach.

    >>And what the hell is a BEAN and how do I use it?

    A Java Bean is analogous to an object or component in .NET.  ActiveX controls are similar to Beans.

    LVL 25

    Assisted Solution

    >> When I compile my C# app, the classes get compiled into a DLL in the bin folder

    DLL's are libraries. Java usually stores libraries either just in a directory structure, or in a JAR (Java Archive File) file (which can be considered a cross between a DLL and a ZIP file in some ways).

    C# apps are generally compiled into EXE's however. Java's equivalent of an EXE as you may already know, is a CLASS file - which stores the Java Bytecode (much like .NET has the MSIL).

    jhance is correct in the answer to your other 2 questions.

    But here's my explanation on Beans:

    As you will no doubt already know from your C# experience, one of the advantages of object-oriented programming is the capability to reuse an object in different programs. If you have created a spellchecker object that works with your word-processing program, you should be able to use the same object with an e-mail program also.

    Sun has extended this principle by offering JavaBeans: software objects that interact with other objects according to a struct set of guidelines—the JavaBeans specification. After you know how to work with one JavaBean according to the guidelines, you know how to work with them all.

    Several programming tools have been developed with beans in mind. These environments, including the free Sun ONE Studio JDE, make it possible to develop Java programs quickly by using existing beans and establishing the relationships among them.

    JavaBean's are pretty much a platform-independent version of Microsoft's OCX technology...

    Bean's are certainly something you can easily avoid with J2SE development, but they're everywhere in J2EE.. And then you get all EJB (enterprise java beans ( etc.
    LVL 7

    Author Comment


    So if I added a JSP page with inline logic to a JSP web app, and accessed that would get compiled into a servlet on first access.  Is that correct?  If so, where is that servlet stored, or do I even need to care?

    If I wanted to build a bean, for portability and reuse, I would need to compile it first (into a .class), add it to the JSP app (how) and call it using the jsp:bean tag?
    LVL 6

    Assisted Solution

    > it would get compiled into a servlet on first access
    exactly, jsp will be first converted to servlet. This happens only when jsp is first accessed or there is some changes in jsp.
    The compiled servlet will be present in the web server or application server that you are using.
    you really dont have to bother about it.

    Java Bean is just another object.  To make use of bean in jsp you will have to add an import in your jsp...

    <%@ page import="java.util.*" %>
    this imports all the classes in java.util package

    Assisted Solution

    I have been working in Java tech for 3 years now I had oppertunity to work on Microsoft tech for last 6 months

    1) Working with core java that is Classes,networking,threads,i/o. reflection,collection classes(though less in number in c#) are similar  so i think no porblem here

    2) There are no DLL's here so all are java classes so don't worry about DLL versioning problem, this is also removed from asp.net2.0 vs2005 its more class oriented now

    3)  If you want to work in Swing API t, It gives you lot of flexibliyt on all the components like Tree, Jtable,Jslider,Jtextbox now even you have taskbar icons and popups there are other components availble most of them free of cost.  It follows a very clear arcticture of MVC and can be managed through a xml config file. Then there is applet for bringing dynamic content on web. there is concept of java web start throuh which you can run desktop swing application on internet advantage of it is that application can be downloaded and update where every you are.

    4) When we talk of JSP and ASP.NET2.0 they are totally different so if you are ASP.NET guy its better to go for JSF ie Java Server Faces its more like component driven)    and there are nice tools like jbuilder and Sun one studio creator(
    5) JSP basically is tag based system more like ASP.   There are lots of tag(funcionlity) for working on JSP like tree structure,table,loops,textareas and you can make your self
    6) Best arctecture for using JSP is to have Servlet,JSP,Bean arctecture with bean managing your clinet side issues and servlet acting as controller (filter servlet), business logic (giving you complete three tier architerture) which you might not have witnessed in  But now in asp.net2.0 there is  3 tier arcitecture.
    hope this helps


    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Suggested Solutions

    This article will show, step by step, how to integrate R code into a R Sweave document
    Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
    This video teaches viewers about errors in exception handling.
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now