Results 1 to 7 of 7

Thread: More Java Questions! (Beginner's stuff)

  1. #1
    Join Date
    Jul 2007
    Location
    America
    Posts
    421
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default More Java Questions! (Beginner's stuff)

    So, I checked a few tuts on Java, got my hello world! program running, made a few functions that added x + y, etc. Beginners Stuff. Now I've just got a few (more) questions.

    1)What's the point of classes/what are they used for exactly?

    2)(Sort of goes with 1) How/Why would one use more than one class in a script?

    3)(Very easy question... I'm "new" at object-oriented programming) I sort of get the gist of objects and such, but I keep on seeing things like 'you need to use awt.robot in java for findcolor stuff', etc. Could someone explain, maybe giving some more knowledge about objects and such?

    4)Is it possible to have a class within a class?

    5)Someone mind explaining inheritance to me?

    I think that's all... thanks for all your help. I'm using the Sun tutorials right now, and they're pretty detailed and very well written, however I think it's sometimes better to get help from a real person.
    I dunno, those asians are pretty difficult to out-auto, legend has it they don't need sleep or food...~tim0suprem0
    Activity is on the decline - school's got me
    Check out my tutorial[s] on Color Finding!||Procedures and Functions!

  2. #2
    Join Date
    Apr 2007
    Posts
    3,152
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    javaomatic.com
    http://www.3dbuzz.com/vbforum/showthread.php?t=129704
    or i have some java tutorials on my comp for the learnign from another person part.

    4) yea im pretty sure

    as for all the others i dont know java well enough
    SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
    Programming Projects: NotePad | Tetris | Chess


  3. #3
    Join Date
    Jul 2007
    Location
    America
    Posts
    421
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks for the tuts, I might look at them later. I was sort of hoping for straight answers, thought...

    anybody else?
    I dunno, those asians are pretty difficult to out-auto, legend has it they don't need sleep or food...~tim0suprem0
    Activity is on the decline - school's got me
    Check out my tutorial[s] on Color Finding!||Procedures and Functions!

  4. #4
    Join Date
    Dec 2006
    Location
    Banville
    Posts
    3,914
    Mentioned
    12 Post(s)
    Quoted
    98 Post(s)

    Default

    1). Classes are like a "Black Box" utility. This simply means you know what goes in, comes out, but not what actually happens. This is useful because you can restrict classes to only doing some things, make them un-inheritable as to prevent tampering, and hide the contents from a user. (A classes information is called its fields, and its functions are methods)

    2). Calling a Java application a script annoys the hell out of me. But anyway, you usually don't need to create classes - most of the functionality is provided in the libraries. However, you might need more than one for some applications where you need to juggle a variety of data. (You actually might want to use a struct for this, but thats different as it contains no methods. A struct is comparable to a Delphi record)

    3). OO programming is kind of different... But what you are referring to as "Java.awt.Robot" is technically an object, in the "awt" library. (http://java.sun.com/j2se/1.4.2/docs/...awt/Robot.html , read that)

    4). Yes, but those classes are only accessible from within that class, unless referenced.

    5). Later, long subject. Look here: http://java.sun.com/docs/books/tutor...heritance.html



    Read farther before asking more questions. Thanks .

    EDIT: Just google "Java <SUBJECT>" and it'll come up.
    The jealous temper of mankind, ever more disposed to censure than
    to praise the work of others, has constantly made the pursuit of new
    methods and systems no less perilous than the search after unknown
    lands and seas.

  5. #5
    Join Date
    Dec 2007
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I think i know the answer for number 1... a class is something that runs the program. when you type something like this in the CMD

    C:\Java\bin1.6.0_03>java addition

    the java is refering to the addition.class

    the java reads from the class and that makes what ever you coded in the class

    confusing?

  6. #6
    Join Date
    Dec 2006
    Location
    Banville
    Posts
    3,914
    Mentioned
    12 Post(s)
    Quoted
    98 Post(s)

    Default

    Besides grave-digging, you're wrong. A class is <my description here>.


    How a class works in compiling a program though is that it has the same name as the file, and it has a "main" method. I think you can make a main method for any class and it get run... I'm not sure though. Might be some Java compiler thing.
    The jealous temper of mankind, ever more disposed to censure than
    to praise the work of others, has constantly made the pursuit of new
    methods and systems no less perilous than the search after unknown
    lands and seas.

  7. #7
    Join Date
    Mar 2007
    Posts
    57
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    only the main class needs a main method. There can be other classes that hold methods

    3). OO programming is kind of different... But what you are referring to as "Java.awt.Robot" is technically an object, in the "awt" library. (http://java.sun.com/j2se/1.4.2/docs/...awt/Robot.html , read that)

    No it is a class in the awt package, an object is an instance of a class.

    Is it possible to have a class within a class?

    Yes

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Unmatched Beginner's Guide to Scripting Scar
    By WhoCares357 in forum Outdated Tutorials
    Replies: 482
    Last Post: 04-08-2011, 08:11 AM
  2. Unmatched Beginner's Guide To Scripting Scar (Hands On)
    By WhoCares357 in forum Outdated Tutorials
    Replies: 44
    Last Post: 09-02-2010, 09:39 PM
  3. All In One Beginner's Guide To Scar Scripting
    By xaviar in forum Outdated Tutorials
    Replies: 4
    Last Post: 07-05-2008, 10:11 AM
  4. A few questions... I'm an extreme newbie at Java
    By Kik in forum Java Help and Tutorials
    Replies: 5
    Last Post: 12-01-2007, 07:43 AM
  5. few java questions. and idea on insanely autoing on RS
    By stylen in forum Java Help and Tutorials
    Replies: 38
    Last Post: 09-21-2007, 03:04 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
  •