Results 1 to 8 of 8
  1. #1
    cew27 is offline Member
    Join Date
    Dec 2007
    Posts
    13
    Rep Power
    0

    Default need a little explanation

    right first off i will introduce my self
    i am 15 currently living in scotland uk and i am interested i java programming
    i am told it is the best programming language to learn as there is the most demand for its programmers in the industry and because it is supposedly the "best" oop language.
    at the moment i am learning the language from java for dummies (4th edition) by barry burd and i'm enjoying it.
    but i am slightly confused about some part of java .... here are a few questions
    1 how can java be run on all operating systems ?, is it compiled as either an exe or a mac file (not sure on name) or are the programs different formats?
    2 when creating a applet does it use the same code as a normal java app? if so does this mean you can just create an applet in an ide and program like normal ( to put it crudely)
    and the final question .... what are ajax and javascript usefull for ?

    i have googled these questions but none of the results answer my main query

    thanks
    replys appretiated

  2. #2
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    9

    Default

    1. Java has an interpreter and classes (the compiled java codes) are binary files that can be interpreted by java interpreters. Java is platform independent because of that special format that can be interpreted. To run your existing java codes, you only need to write the java interpreter on that platform and then you can run same class files on any platform.

    2. Yes applets are in the same binary format and again all you need to have a java interpreter for your browser or a bridge for your browser to access the interpreter for that OS/platform!

    3. I don't know much details but Ajax and javascript are for web only. Ajax is an extension of javascript for better user experience on web. You should read a little bit about it. Then you can understand better yourself when you see in which purpose they are used for. It is difficult for me to defien them but if you have more specific questions related to java i might help..

  3. #3
    cew27 is offline Member
    Join Date
    Dec 2007
    Posts
    13
    Rep Power
    0

    Default

    thanks for the reply but im still a but confused about the class and how it is "ran" when i compile the java source code it creates a .class file but this isnt regocnisable by the os (windows vista) and i can only run it via cmd?
    at the moment i am only creating programs that display text in commad promt.

  4. #4
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    9

    Default

    java command is the interpreter i was talking about! So for linux you need another native application to run java classes (e.g. /usr/local/java1.6/jre/java)

    So the format of class files are platform independent but you still need different interpreters to run these class files on different platforms.

    Think about a c/c++ program, when you compile it it is only executable for that platform (mac/linux intel/sparc...), but this is not the case, compiled java codes can be run anywhere. Hope it is more clear for you now.

  5. #5
    cew27 is offline Member
    Join Date
    Dec 2007
    Posts
    13
    Rep Power
    0

    Default

    im afraid i dont ... i dont want to annoy you but for proper java programs (e.g. the ones the companies use to check stock) the file format is a class file?

  6. #6
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    9

    Default

    the file format is a class file?
    Yes. Do you have any reason not to believe this :)

    You might start by reading these:

    Interpreted language - Wikipedia, the free encyclopedia
    Bytecode - Wikipedia, the free encyclopedia

  7. #7
    cew27 is offline Member
    Join Date
    Dec 2007
    Posts
    13
    Rep Power
    0

    Default

    i understand the concepts i was just confused as i cant seem to run the java programs exepts from the command line and i always thaight java programs were execute as .jars or something
    sorry for being a n00b

  8. #8
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    9

Similar Threads

  1. Class explanation
    By mcal in forum New To Java
    Replies: 1
    Last Post: 02-05-2008, 07:50 PM
  2. Explanation bout threading and concurrency?
    By cruxblack in forum New To Java
    Replies: 1
    Last Post: 08-10-2007, 11:33 AM
  3. I need didactic explanation
    By Eric in forum New To Java
    Replies: 2
    Last Post: 07-02-2007, 06:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •