Results 1 to 6 of 6
  1. #1
    ChazZeromus is offline Member
    Join Date
    Sep 2008
    Posts
    13
    Rep Power
    0

    Default I have Questions -_-

    Hi, I'm new to the java programming language and I'd really like to learn all its facilities as fast as I can. I am right now, to my perspective, a very experienced non-virtual platform programmer. Of course my main languages are C++ and ASM and I would like to integrate the java runtime environment into my operating system that I'm designing. And I understand classes in C++ and it's polymorphic implementation. So since I already know that, I realize some java limitations and facilities and would like to know some things that need to be cleared. I am using NetBeans IDE and it's really awesome, just so that everyone knows.

    1) What's the difference between extends and implements?

    2) Package keyword.

    3) When using a private/public keyword, what does it mean when it's use in defining a class itself and not just members?

    4) When exactly when you would use the new keyword? I know that in C++ new is allocates memory so that a pointer can point to the new memory, but I notice that java does not have any pointer facilitation. I already have hypothesis's as to why, but I want a concise answer.

    5) And any other common C++ confusion with java.

    Thank you for reading my post. I look forward to having a good time talking to other developers here.

  2. #2
    Eku
    Eku is offline Senior Member
    Join Date
    May 2008
    Location
    Makati, Philippines
    Posts
    234
    Rep Power
    7

    Default

    umm ^_^ java is a much bigger world than C++ and ASM. I myslef also started my early programming days with c++ and TASM.
    Here is my hint, you can start of by learning Core java. You can find all the answers to your question in the Java tutorial which can be downloaded from the sun site ^_^

    I think I'll answer this question:

    4) When exactly when you would use the new keyword? I know that in C++ new is allocates memory so that a pointer can point to the new memory, but I notice that java does not have any pointer facilitation. I already have hypothesis's as to why, but I want a concise answer.

    It is because the Java Run-time Environment handles all the variables. you do not have to worry about this things ^_^ As i recall my instructor told me that in Java all the varaibles are handled by the JRE. The JRE allocates the memory used by that Variable. And if your system is finished using those variables, the JRE (Java Run-time Environment) cleans those used memory maps which is called the "garbage collection". I hope my memory remembers hte rigth words. Let wait for others to reply on your questions ^_^
    Mind only knows what lies near the heart, it alone sees the depth of the soul.

  3. #3
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by ChazZeromus View Post
    4) When exactly when you would use the new keyword? I know that in C++ new is allocates memory so that a pointer can point to the new memory, but I notice that java does not have any pointer facilitation.
    First, your topic/thread title is meaningless. You really should pick a meaningful title, as it will encourage folks to answer it.

    One critical difference between Java and C (and assembler languages) that that you never use pointers. You can not do pointer arithmetic. There are no expresions that yield a pointer that you can do anything with.

    The line:
    Java Code:
      MyObject myObj = new MyObject():
    creates an instance of a MyObject() object, and the variable "myObj" is a reference to it. The reference works much like a C++ reference, and the syntax here is exactly what it is in C++. But it is illegal and illogical to do something like:
    Java Code:
    myObj++;
    in Java, whereas it is fine in C++.

  4. #4
    ChazZeromus is offline Member
    Join Date
    Sep 2008
    Posts
    13
    Rep Power
    0

    Default

    ...that answers one question...
    Oh yeah, on another note, is the run time environment open source?

  5. #5
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    what do you mean "open source"?

    Java as a whole is owned by Sun Microsystems. There are pure FOSS implementations of the compiler and runtime system (JVM). And Sun is moving to make more and more of Java be open source at some level.

    Sun has, in the past, said that Java is free, but they control it. They are loosening their control, slowly.

    More importantly, why do you care? What part of open source is important to you?

  6. #6
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default no poly

    Quote Originally Posted by ChazZeromus View Post
    Hi, I'm new to the java programming language and I'd really like to learn all its facilities as fast as I can. I am right now, to my perspective, a very experienced non-virtual platform programmer. Of course my main languages are C++ and ASM and I would like to integrate the java runtime environment into my operating system that I'm designing.
    The main thing to grasp first is that something along the lines of stack pointer checking is built into Java from the get-go. A runaway pointer will be trapped and thus one may do prototyping in Java as though running in a sandbox or dedicated prototyping tool. Java as well has Threads built into the api, though there is some deep discussion available for those who wish to do real cs.

    Quote Originally Posted by ChazZeromus View Post
    And I understand classes in C++ and it's polymorphic implementation. So since I already know that, I realize some java limitations and facilities and would like to know some things that need to be cleared.
    I see a lot of very deep insight from pros on this poly thing, but I prefer digging through the code rather than reliance on rtti - which we do not have vftable dispatching at runtime, we do have a sophisticated typing system which will back-climb the typing at compile time with remarkable adroitness. You may be able to provide suggestions on how to find the closest common ancestor in a typing dependency where two types that rely on the notion of a class to do typing find nearest common ancestor at compile time.

    That won't do much for your code studies, but it will identifiy where java differs from cpp.

    Quote Originally Posted by ChazZeromus View Post
    1) What's the difference between extends and implements?
    implements defines methods ( functions in cpp ) that a class promises to provide a code body for. extends gets into java's reliance on classname for typing - java is a strongly typed language. No void anything anywhere and no unsigned numerics: Even bytes are signed, which makes for need of special class BigInteger to do some operations.
    Quote Originally Posted by ChazZeromus View Post
    2) Package keyword.
    namespaces.
    Quote Originally Posted by ChazZeromus View Post
    3) When using a private/public keyword, what does it mean when it's use in defining a class itself and not just members?
    File scope issue: One public class per file, all other classes in a compilation unit are default access. Keyword is default is not coded, it is implied and is used in discussions of scope.

    Quote Originally Posted by ChazZeromus View Post
    4) When exactly when you would use the new keyword? I know that in C++ new is allocates memory so that a pointer can point to the new memory, but I notice that java does not have any pointer facilitation. I already have hypothesis's as to why, but I want a concise answer.
    How deep do you want the observation?

    Quote Originally Posted by ChazZeromus View Post
    5) And any other common C++ confusion with java.
    Google Cay S. Horstmann, note that Java has a remarkable Lib's far exceeding STL - What is your design challenge?
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

Similar Threads

  1. *mostly* GUI questions from a JavaNewb
    By bshak1 in forum New To Java
    Replies: 6
    Last Post: 09-09-2008, 04:38 AM
  2. Questions About JSP?
    By mtz1406 in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 08-19-2008, 08:56 PM
  3. Just a Few Questions
    By pringle in forum New To Java
    Replies: 21
    Last Post: 01-09-2008, 07:21 PM
  4. questions
    By Gilgamesh in forum New To Java
    Replies: 3
    Last Post: 11-28-2007, 12:18 AM
  5. 3 Questions
    By hiranya in forum AWT / Swing
    Replies: 4
    Last Post: 11-14-2007, 05:57 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
  •