How to learn technics in wrting class, objects and methods

Hi ,
I am new this oops methodology. I know java language but don't know the basics. I mean to say I have no idea how to write classes and methods. I can write one single class with all the methods and I can call that class from an another class but this is not the way... I knew it but I am kinda confuse how to write the well structured oops style classes and methods....
Can anybody help me please........
Thanks

A short simple (overly simple) explanation is that objects are like little machines, which operate independantly from other objects (other little machines). You design an application as a collection of these little machine/objects, interacting with each other. Then you drill down another layer of detail, and design the machines themselves. You do this by defining the classes, which are like blueprints to make a little machine/object.
In java, this is largely expressed by the interface definition at the higher level, and the class definition at the lower level. The interfaces say how various objects may talk to each other, and the class definitions say how any individual object may talk at all.
This is a very basic description, and in fact isn't entirely accurate; if they want to lots of people on this forum could pick it apart. But hopefully it gets the idea across. (As my language design prof said, quoting somebody else, "teaching is just a series of lies.")
There are resources on the web about object-oriented programming, object-oriented design, etc. mutmansky's right, a college course is best, but you can still learn a lot from docs on the web.

Similar Messages

  • Delete Class Objects and methods

    Hi, i have created a class file for a game. Now i have 3 to 4
    games in one Main File. So after playing one game user can choose
    another. Now can anybody tell me how to delete the first class
    Object or methods, which was used in First game. So that i can
    remove the garbage collections from Flash to make it with fast
    process?

    A short simple (overly simple) explanation is that objects are like little machines, which operate independantly from other objects (other little machines). You design an application as a collection of these little machine/objects, interacting with each other. Then you drill down another layer of detail, and design the machines themselves. You do this by defining the classes, which are like blueprints to make a little machine/object.
    In java, this is largely expressed by the interface definition at the higher level, and the class definition at the lower level. The interfaces say how various objects may talk to each other, and the class definitions say how any individual object may talk at all.
    This is a very basic description, and in fact isn't entirely accurate; if they want to lots of people on this forum could pick it apart. But hopefully it gets the idea across. (As my language design prof said, quoting somebody else, "teaching is just a series of lies.")
    There are resources on the web about object-oriented programming, object-oriented design, etc. mutmansky's right, a college course is best, but you can still learn a lot from docs on the web.

  • Re: Beginner needs help using a array of class objects, and quick

    Dear Cynthiaw,
    I just read your Beginner needs help using a array of class objects, and quick of Dec 7, 2006 9:25 PM . I really like your nice example.
    I also want to put a question on the forum and display the source code of my classe in a pretty way as you did : with colors, indentation, ... But how ? In html, I assume. How did you generate the html code of your three classes ? By help of your IDE ? NetBeans ? References ?
    I already posted my question with six source code classes ... in text mode --> Awful : See "Polymorphism did you say ?"
    Is there a way to discard and replace a post (with html source code) in the Sun forum ?
    Thanks for your help.
    Chavada

    chavada wrote:
    Dear Cynthiaw,
    I just read your Beginner needs help using a array of class objects, and quick of Dec 7, 2006 9:25 PM . I really like your nice example.You think she's still around almost a year later?
    I also want to put a question on the forum and display the source code of my classe in a pretty way as you did : with colors, indentation, ... But how ?Just use [code] and [/code] around it, or use the CODE button
    [code]
    public class Foo() {
      * This is the bar method
      public void bar() {
        // do stuff
    }[/code]

  • Customize class members and methods showed by IDE

    Is anyway to customize the output of the class members and methods show by IDE when you code a class?
    In detail:
    If you have a class A:
    A myClass = new A();
    and you tipe myClass.
    then the IDE show you a list of class members and methods in a Dialog Box....
    can you customize these????????
    I want to set another output for these....
    Thanks!

    That's not the meaning of the question.....
    When someone work with a Java IDE and are editing source, the IDE help you writing code showing you the members and methods of the object that you are working on, like these:
    a.------------------------
    | void setX(int x) |
    | void setY(int y) |
    These information is provided by the IDE. I think that it makes a special type of introspection on classes ..... but a really strong one, because it can access to private members and methods....
    I want to customize these behaviour....... and i want the IDE's show only the strings that i want....
    For exemple:
    a.------------------------
    | to establish X |
    | to establish Y |
    Thanks!

  • Track public classes, interfaces and methods by ID

    Hi All,
    I'm wondering whether there is a tool to assign a unique ID to classes, interfaces and methods (eg. within Javadoc) and track these IDs.
    The reason I'd need such a feature is that I'd like to do requirements tracking in an easy but complete way. I have a document containing functional specifications (with IDs) and on the other side there is the source code; where the javadoc of the public methods and classes is my software specification. What I now want to do is make a link between the IDs in the functional spec to the IDs in the sofware spec (ie. the source code).
    Does anybody know of such a tool (commercial or not)?
    Thanks,
    Daniel

    I'm a bit confused as to whether or not I understand you correctly. Please tell me if the following pseudocode is somewhat like the solution you are looking for:
    class MethodFunctionality {
       private Class methodClass;
       private String methodSignature;
       private List methodFunctions;
        *   Returns true if the method is used for the specified
        *   requirement, false otherwise.
       public boolean fulfills(int requirementId) {
          if methodFunctions.contains(requirementId)
             return true;
          else
             return false;
       public String getMethodSignature() {
          return this.methodSingature;
       public Class getMethodClass() {
          return this.methodClass;
        *   Returns an array with IDs of each functional
        *   requirement covered by the method.
       public int[] getCoverage() {
          return this.methodFunctions;
    class ClassFunctionality {
       private Map methodDetails;
       private List classFunctions;
       public MethodFunctionality getMethodDetails(String methodSignature) {
          return (MethodFunctionality) this.methodDetails.get(methodSignature);
        *   Returns true if the class is used for the specified
        *   requirement, false otherwise.
       public boolean fulfills(int requirementId) {
          if classFunctions.contains(requirementId)
             return true;
          else
             return false;
        *   Returns an array with IDs of each functional
        *   requirement covered by the class.
       public int[] getCoverage() {
          return this.classFunctions;
    }Mapping classes and methods to functionality like this would both allow you to query each class and method for all the functional requirements they claim to cover and would allow you to collect all classes and methods involved for a particular functional requirement.

  • Hidding java class field and methods

    Hi,
    I'm developing an API and I want to know if there's any way to hide all private class, field and methods when exploring the JAR from eclipse or another IDE. In [this capture|http://i8.photobucket.com/albums/a32/darkskimmer/Sinttulo-1-2.jpg] I can see "extra-information" like return type of private methods, etc. I want to keep this in secret...
    Cheers!
    P.S: I have to improve my english skills, I know... :)

    darkskimmer wrote:
    I'm developing an API and I want to know if there's any way to hide all private class, field and methods when exploring the JAR from eclipse or another IDE. Since the JVM has to be able to see them to access/execute them and and anything it can do you can do then you can't hide them.

  • Help with Classes, Objects and their relationship.

    Alright, I've got this assignment from a computer science class that won't stop annoying me and I need some help. This is the complete assignment: http://zebra0.com/Tarraga/CS103/Project4.php
    What I'm having issues with is the course specifications. It says:
    ? Create a course class. It will contain the course name, 5 Student objects, the number of Students, etc. It will contain an addStudent(), printRoll() and average() methods. You may add methods as needed. The average method computes the average of all students test score averages.
    I'm not sure what my instructor means by 5 student objects. I'm assuming that addStudent() would create a new student() object (from the class which I've already created here: http://zebra0.com/Tarraga/CS103/studentP4.php) and printRoll() will print the existing objects, average() I think I know.
    So...wth am I supposed to create 5 student objects for? Or what are they referring to? I'd assume that the student objects are created only when the user inputs the student data, not internally.
    My question is what I'm assuming to be extremely newb-ish, and to be honest I am a complete newbie, but if anyone can help please do so.
    Edit: Another question I had regarded my student class would be, do I need to write getters/setters for every value in there? My instructor wouldn't stop raving about how we need getters/setters, but at this point I'm not exactly sure what they do.

    to didittoday:
    You could say that, yes. But honestly...I've been paying plenty of attention. What I've learned so far about an object in Java is the following:
    An object in programming is like an object in real life. It makes up the program. Just like a wheel is part(object) of a card, an object is part of the program.
    That's what my teacher has taught me, with pictures even. I've written about two GUI and one non GUI projects so far that I had to look to the book to actually finish. And that's her general answer to all our questions, "read the book!" She doesn't ever take time from showing us her precious powerpoints to actually teach us. And not once has she actually given us examples of coding. She instead directs us to the programs in our book which may or may not be of relevance.
    And all the tutors who could actually help me aren't on campus. If you'd like to redirect me to a link that may hold useful (and RELEVANT) information, please do so.
    Also: I do understand that a student object would hold student information (I.E.:
    public student (String firstname, String lastname, double score1, double score2, double score3, double score4)but I don't understand why 5 student objects should be created in the other class...is it that they have to be initialized and then once the user inputs the information, they are updated? I'm grasping at straws here.
    Edited by: Valkyrio on Mar 5, 2008 3:28 PM

  • Why is the Integer wrapper class object and primitive object equal ?

    This is my code :
    package obectorientation;
    public class oo3 {
         public static void main(String[] args) {
              int x=1; float y=1.0F;
              int x1=1;
                                    Integer y1= new Integer(1);
              if(x1==y1)
                   System.out.println("Equal");
              else
                   System.out.println("NOT Equal");
    O/P : EqualMy question is why are x1 and y1 equal ? Won't y1 be a different object and x1 just a primitive variable ?
    Thanks in Advance.

    Specifically, it's because y1 gets unboxed before the comparison. What's really happening is effectively: if ( x1 == y1.intValue() )

  • How to convert a String variable as class name and method name?

    i have two classes
    class Student
    public String insertStudent(String sname)
    { return("Student has been inserted ");     }
    class Teacher
    public String execute(String methodName, String className)
    {  //return statement of the method 'insertStudent' in the class 'Student'; }
    }Now, i have a class with the main method. Here, i would like to call the method *'insertStudent'* of class *'Student'*
    using the method *'execute'* of class *'Teacher',* passing the method-name and the class-name (viz. insertStudent, Student) as the
    String parameter.
    Can anyone please help me out. Thanks
    regards,
    chinglai

    You should have just added that as a comment on your [initial posting|http://forums.sun.com/thread.jspa?threadID=5334953] instead of starting a new thread.
    Now, i have a class with the main method. Here, i would like to call the method 'insertStudent' of class 'Student'using the method 'execute' of class 'Teacher', passing the method-name and the class-name (viz. insertStudent, Student) as the
    String parameter.
    Why oh why? What do you want to achieve?
    Let me tell you: there is a way to do what you try to do, but it's not recommended and should be used only very sparingly. Especially not in anything like your code, that resembles normal business logic (as opposed to an application framework such as Spring, for example).
    Can you explain what exactly you want to do with that? Why should a Teacher be able to call any random method ony any other class. And what good would that do?

  • How to get class name and method name within a class method?

    Hi,
    In a java class, is it possible to get its class name and the class method?
    Please advise.
    Thank you.

    I mean whether there's any built-in command that will
    return the class name instead of code it ourself, for
    easier maintenance.
    Possible?
    this.getClass().getName();

  • Understanding Java superclass hierarchy through System objects and methods

    I wanted to see if I can manipulate datastreams manually rather than relying on classes.
    I knew that System.in was an InputStream object so it must use the said methods such as System.in.read()
    I made a program for it. It gave me an IOException. When I went to "catch" the exception it said cannot find symbol IOException. This was fixed by import java.io.*;
    I find that very weird conceptually. First System.in is wrapped by the System class. I have no need to import java.io.*; to use System so why would I need to import it in this case. Second, when I use Scanner to read in from System.in I do need to import java.io.*, yet I'm pretty sure it makes the same method calls to System.in I make, no?
    //import java.io.*;
    public class streams
         public static void main( String[] args )
              try {
                   System.out.printf( "%c\n", System.in.read() );
              } catch (IOException e) {
                   System.err.println( "IOException error" );
    }

    Importing does not make classes available. All it does is tell the compiler that when you say "IOException," it is actually shorthand for "java.io.IOException." The import applies only to the class in which it is declared, and only at compile time. It is gone once you compile your class. It does not show up in the .class file, and has no effect whatsoever at runtime.

  • Regarding Business Objects and Methods

    Hi ,
    I need to create LSMW with BAPO for to create PO.
       Where shoud I found Business Objects and their method.
        Could you please suggest abt this.
    Regards,
    Sai.

    sai,
      "BAPI_PO_CREATE "  ( OR )  "BAPI_PO_CREATE1 "
    Goto SE37>Enter above bapi name>select where used list>it will show list>
    select prog RBUS2012
      or directly se38>RBUS2012>Press F7  or Display.
    Pls. reward if useful

  • Channel URL to contain object and method name

    Hi,
    There are many WEB features and filters that are based on the URL path or paramters.
    BlazedDS uses the same URL to send all the remote object calls.
    I can add more and more channels and map each remote object to one of the channels but it doesn't scale and even with it all the methods on the same object will look the same.
    I know that the binary body contains the service name and method name , but this is not enough .
    I need to have the  URL path/ parameters to contain the service and method names.
    Is there any way to control the URL in the remote method beside of the set channel?
    Shlomo.

    OK,
    I think I found the way.
    The API of the RemoteObject presents the endPoint property:
    '"This property allows the developer to quickly specify an endpoint for a RemoteObject destination without referring to a services configuration file at compile time or programmatically creating a ChannelSet. It also overrides an existing ChannelSet if one has been set for the RemoteObject service."
    It means that before every call to a method I can set the end point to something like "http://.../messagebroker/amf?serice=MyService&method=MyMethod...
    Shlomo

  • Converting a string to Class object and calling its method

    I have recently moved to Java and I need help on this specific issue given below.
    I have to do this :
    ValModule1 val1 = new ValModule1();
    ValModule2 val2 = new ValModule2();
    if(val1.checkModule(xmlDocument)){
    $i++;
    There are many ValModule* classes and they all have the method called checkModule in them. I need to instantiate each class and run the checkMethod which returns true or false. My problem is that I am trying to get the name of the module (if it is ValModule1 or 2 or 3) from the user. What I get from the user is the name of the class for which I should call checkModule method on.
    how can I convert this string validationname given by the user and instantiate that class and call the method?
    I have tried this:
    String str="c:/xpathtest/src/Plugin_Config.xml";
    File xmlDocument = new File(str);
    String cls = "ValModule1"; // assuming this is what the user gave me
    Class t = Class.forName("ValModule1");
    Object o = t.newInstance();
    After that if I try
    if(o.checkModule(xmlDocument)){
    $i++;
    It gives me an error saying that it is not an existing method
    cannot resolve symbol
    [javac] symbol : method checkModule (java.io.File)
    [javac] location: class java.lang.Object
    [javac] if(o.checkModule(xmlDocument)){
    [javac] ^
    [javac] 1 error
    Can you please let me know where I am screwing up :-) ? If you need me to put both the programs I can do that too. Thanks in Anticipation

    I have recently moved to Java and I need help on this
    specific issue given below.
    I have to do this :
    ValModule1 val1 = new ValModule1();
    ValModule2 val2 = new ValModule2();
    if(val1.checkModule(xmlDocument)){
    $i++;
    There are many ValModule* classes and they all have
    the method called checkModule in them. I need to
    instantiate each class and run the checkMethod which
    returns true or false. My problem is that I am trying
    to get the name of the module (if it is ValModule1 or
    2 or 3) from the user. What I get from the user is
    the name of the class for which I should call
    checkModule method on.
    how can I convert this string validationname given by
    the user and instantiate that class and call the
    method?
    Define an interface containing the method all your classes have in common, cast the Object reference returned by newInstance to that interface, then you can call that method.
    Good Luck
    Lee

  • How to set up permission for portal objects and folder

    Hi All,
    We are implementing EP 7.0. For creating portal objects, I have assigned "Super_admin, Content_admin, System_admin and User_admin" role to my userid and created iviews, roles and folder.
    During SAP audit they asked us to open a Iview to show the permission,   the below are the value shown in permission editor.
    Role Name           ====== Administrator ===== End  User ======Role Assigner
    Everyone             ======  Read            ======Yes        ====== No
    Super_admin_role ====== Owner            =====Yes         ======Yes
    SAP asked us to change the permission and said "Super_admin_role" should not be used, they asked us to create a group or role and assign. We are not clear what SAP wanted us to do.
    Can any one let me know how this permission needs to be given and whether "Super Admin" role can be assigned to a userid.
    Thanks in advance.
    Rgards,
    H.K.Hayath Basha.

    Hi Michael,
    I didn't create any role. I will let yo know what I have done so far.
    1. Created a group called "ADMIN_GROUP".
    2. Assigned "SUPER_ADMIN" role to group "ADMIN_GROUP.
    3. Assigned userid "ADMIN_USER" to group "ADMIN_GROUP".
    4. Opened the persmission of "PORTAL_CONTENT" folder and added group "ADMIN_GROUP" and set this group as "OWNER",  "END_USER" check box is ticked and "ROLE_ASSIGNER" check box is checked.
    5. Removed the role "SUPER_ADMIN" from  group "ADMIN_GROUP".
    6. Logged into portal using "ADMIN_USER" created a folder called "TESTING". Then opened the
        permission editor for the folder "TESTING", it showed three record
        "ADMIN_GROUP"           === OWNER  === 'X' === 'X'
        "EVERY_ONE"               === READ     === 'X' === ' '
        "SUPER_ADMIN_ROLE. === OWNER  === 'X' === 'X'
    7. I am not able to delete "SUPER_ADMIN_ROLE" from the permission editor, as it is greyed.
    With the above steps what I have achieved is I have given permission to group "ADMIN_GROUP". Is this what we need to do. Did I did anything wrong.
    Regards,
    H.K.Hayath Basha.

Maybe you are looking for

  • New to Logic 9, Questions about mixing with summing box.

    Hello - glad to be aboard. I just picked up Logic9 last week.. I have been on DP...well since it was P (I guess 20yrs,) Been contemplating the move for quite some time, but as I too, pay the bills with music, I've got to stay on DP until I and Logic

  • Default Values in an ABAP selection criteria

    Hi SAP Experts, I've created a info set(SQ02) and a query(SQ01) to generate a report on purchase orders. I want to default the purchase order type to NB in the selection screen(In order to retrieve the purchase orders with type NB only) Can someone p

  • Problem in triggering of workflow

    Hi All, We have custom events assigned to bus2104.In Event linkage transaction SWW_WI_CREATE_VIA_EVENT is passed to Receiver Function Module and "Linkage Activated" = 'X'. In  quality server after approval request (t.code IMA1N) is created and status

  • Loading Essbase Members for [ Accounts ] Dimension in ODI 11.1.1.3 ?

    Hi My source is Oracle Database tables and Target is Essbase Members of Dimension ('Accounts') i m trying to load Data to Accounts member (Employee Rate) When i perform Reverse Engineering I am only able to view Dimensions not is members. So in my in

  • Finding table names

    Hi, I have one transaction CRM_DNO_MONITOR . In that i have opened one service order transation. It has three tabs like Fast entry, Item details and transactional data. Each has lot of fields in it . As i wanted to know table names of all those field