Access instance method of a class inside instance method of another class

Hi Friends
I have to use one c1->m1.
c1 is a public instantiation and m1 is a public Instance Method.
I called this m1 method by creating c1 object for class c1.
But problem is inise M1 method,i have a statement
CALL METHOD mo_central_person->if_hrbas_pd_object~read_infty.
here mo_central_person is of type some other class c2.
As without creating the object,i didn't use the above interface method.
Can please suggst me how to handle this.
Regards,
Sree

class a definition.
  public section.
  methods : display,
            disp.
  data : a(10) type c value '10',
         b(5) type c value 'abc'.
endclass.
class a implementation.
  method display.
    write : a.
  endmethod.
  method disp.
    write : b.
  endmethod.
endclass.
class b definition inheriting from a.
  public section.
  methods : display1.
  data : c(7) type c value '7'.
endclass.
class b implementation.
  method display1.
   call method display( ).
    write c.
  endmethod.
endclass.
start-of-selection.
data : o_obj type ref to b.
create object o_obj.
call method o_obj->display1.
the method display is in class a.
we can call this method in class b using the following statement.
method display1.
   call method display( ).
    write c.
  endmethod.

Similar Messages

  • To define a class inside a method

    Hi,
    Iam new to OOPS ABAP.
    I had one doubt,
    Can we define and implement a new class inside a method... end method (like below)
    Method M1
    Class C1 Defination.
    Class C1 Implementation
    Method
    Endmethod
    Endmethod
    Please suggest me on this how to proceed.
    Regards
    Srinivas

    Hi Rich Heilman/Naimesh
    The requirement is
    In XI Proxy(XI proxy is related to creation of materials in SAP),there are macros defined, and my client told us to find out wheather is it possible to replace the macros with the classes and methods.
    Can i define a global class and call that method inside the class.
    Method M1
    Define a global class oref
    create object.
    Call method oref->m2.
    Endmethod
    Can i do it in the above way.Please suggest.
    Regards
    Srinivas

  • How to copy an array element in one class to an array in another class?

    Hi,
    I have a ClassRoom class that stores a list of Student objects in an array. How would I copy a Student object from the Student[] array in the ClassRoom class to an array in another class?
    Is it something like this:
    System.arraycopy(Students, 2, AnotherClass.Array, 0, 2);In an array do the items get copied over existing array elements or can the be added to the end? If so, how would I specify add copied object reference to the end of the array in the other class?

    drew22299 wrote:
    Hi,
    I have a ClassRoom class that stores a list of Student objects in an array. How would I copy a Student object from the Student[] array in the ClassRoom class to an array in another class?
    Is it something like this:
    System.arraycopy(Students, 2, AnotherClass.Array, 0, 2);In an array do the items get copied over existing array elements or can the be added to the end? If so, how would I specify add copied object reference to the end of the array in the other class?System.arrayCopy will overwrite whatever is already in the array. It is your job to make sure it copies into the proper array location.
    That being said, you're only moving a single student. This is not something you would use arrayCopy for, as you can just do that with simple assignment. Also, you should consider giving Class a method to add a student to its student list, as the class should know how many students it has and can easily "append" to the array.
    Note: I hope you noticed the quotes around append. Java's arrays are fixed size. Once allocated, their size cannot change. You may want to consider using one of the List implementations (ArrayList, for example) instead.

  • Can I invoke a class that extends JAppl from another class extends JAppl

    Can I invoke a class that extends JApplet from another class that extends JApplet. I need to invoke an applet then select an action which opens another applet. Thanks in advance.

    Nobody is able to solve this problem, i cant even
    think this things. i have hope so plz try and get
    result and help.Did you understand what Sharad has said???
    Yep, you can forward to specific error page from servlet when even error occured in JSP. In order to achieve you have to open jsp file from servlet say example by using reqdisp.forward.
    handle exception in the part where you are forwarding. And forward to the specific error page inside catch block.

  • Inner class inside a method - how does it access method's local variable?

    hello All:
    I've learnt that, an inner class, if defined inside a method, it can access the method's local variables, only when they are defined as "final".
    Anyone can help explain the rationale behind it?
    Thanks a lot!
    Sway

    fathomBoat wrote:
    In java, everything is about pass-by-reference.
    Wrong! Nothing in Java is ever pass-by-reference.
    Java uses pass-by-value everywhere.
    It makes sense to me if the reason of enforcing a variable to be "final" is to prevent it being messed up.No, the reason is that a copy is made and if the variable weren't final then it could change later on and the developer could be confused because his inner class didn't "see" that change.
    The variable being final prevents that scenario.
    However, if a copy of the variable is made inside the inner class, i dont see how possible it could affect variables outside of class?Such a copy is made, but the language designers wanted to hide that fact from the developer. By forcing all accessed variables to be declared final the developer has no way to realize that he's actually working on a copy.

  • Class inside main method?

    can we write class inside tne main method in java? If yes kindly explain with example.

    > can we write class inside tne main method in java? If
    yes kindly explain with example.
    The Java? Tutorial - Nested Classes
    ~

  • Calling a method and setting an ImageIcon with source from anoth class

    I am trying to make a simple game, first I am trying to set up a game board, and make it possible to place units on the board. (This game will probably never be possible to play, I am just using it to try to understand Java, GUI, Swing, and using more than one class).
    So far I have 4 classes: Board (extends JFrame, sets up a gameboard, on which to place the pieces), Unit (a class from which the specific units types will inherit), Horse (my only type of unit, which extends the Unit class), and Game (which calls methods from the other classes).
    (These don't do much now.. this is what they will do, hopefully).
    All these classes are in a package called Gamev1.
    In the main method of Game, I do:
    ---code--
    public static void main (String[]args){
    new Board().show();
    Horse horseUnits[] = new Horse[1];
    horseUnits[0] = new Horse();
    horseUnits[0].moveUnit(squares[0]);
    end of code--
    when I debug it I get:
    myjava/FirstGraphics/Gamev1/Game.java [25:1] cannot resolve symbol
    symbol: variable squares
    location: class.myjava.FirstGraphics.Gamev1.Game
    horseUnits[0].moveUnitsquares[0]);
    1 error
    ---code----
    moveUnit(JLabel moveTo)
    is a method in Unit class:
    public void moveUnit(JLabel moveTo){
    target=moveTo;
    target.setIcon(this.image);
    if (this.position !=null)
    this.position.setIcon(noUnit);
    this.position=moveTo;
    ---end of code---------
    squares[] is an array of JLabels which is set up in the Board class, whenever a new Board is created:
    ---code---
    JLabel squares[] = new JLabel[100];
    for (int s=0; s<100; s++){
    squares[s] = new JLabel();
    ---end of code---
    I tried changing the reference from squares[0] to Board.squares[0] but I got the same error message in debug.
    Any idea what is wrong?
    I have another problem, which is probably similar.
    in the Board class I call:
    squares[s].setIcon(Unit.noUnit);
    and in the Unit class I have:
    static ImageIcon noUnit = new ImageIcon("images//none.gif");
    I don't get an error message mentioning it, but (without the attempt to place the horse on the board) the program compiles, but doesn't put this image on the labels. Any idea what is the porblem here?
    If I have not given enough information for anyone to help me, please tell me what further information I should give.
    Thanks to anyone who answers.

    I got it to work with
        Board board = new Board();
        horseUnits[0].moveUnit(board.squares[0]);To use Board.squares[0], squares would have to be static.
    The ImageIcon seemed to work okay. I noticed that your post had two slashes in the url [/] - that might throw things off . . .
    The code below has the icon call at the end of setLabeLProperties.
    I got carried away playing with the graphics so the squares don't work very well.
    import java.awt.*;
    import java.awt.geom.*;
    import javax.swing.*;
    public class HumaniBlue {
      public static void main(String[] args) {
        Board board = new Board();
        board.show();
        JLabel label5 = board.getLabel(5);
        //System.out.println("label5 name = " + label5.getText());
        Horse[] horseUnits = new Horse[1];
        horseUnits[0] = new Horse();
        horseUnits[0].moveUnit(board.squares[0]);
    class Unit {
      static ImageIcon noUnit = new ImageIcon("images/bclynx.jpg");
      public void moveUnit(JLabel square) {
    class Horse extends Unit {
      public Horse() {}
    class Board {
      JFrame f;
      JPanel gameBoard;
      int labelSize;
      JLabel[] squares = new JLabel[16];
      GridBagConstraints gbc = new GridBagConstraints();
      public Board() {
        gameBoard = new JPanel(new GridBagLayout()) {
          public void paintComponent(Graphics g) {
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            double width  = getSize().width;
            double height = getSize().height;
            g2.setPaint(Color.white);
            g2.fill(new Rectangle2D.Double(0, 0, width, height));
            g2.setPaint(Color.black);
            Shape line;
            double
              gridSize = (width < height ? width : height) * 0.8,
              gridUnit = (width < height ? width : height) / 5,
              x = (width  - gridSize) / 2,
              y = (height - gridSize) / 2;
            labelSize = (int)gridUnit;
            for(int j = 0; j < 5; j++) {
              line = new Line2D.Double(x, y, x, y + gridSize);      
              g2.draw(line);
              x += gridUnit;
            x = (width - gridSize) / 2;
            for(int j = 0; j < 5; j++) {
              line = new Line2D.Double(x, y, x + gridSize, y);
              g2.draw(line);
              y += gridUnit;
          //System.out.println("width = " + width + "\theight = " + height + "\n" +
          //                   "x = " + x + "\ty = " + y + "\n" +
          //                   "gridSize = " + gridSize + "\tgridUnit = " + gridUnit);
        f = new JFrame();
        f.getContentPane().add(gameBoard);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setSize(400,400);
        f.setLocation(600,200);
        //f.setVisible(true);
        setLabelProperties();
      private void setLabelProperties() {   
        int
          r   = 30,
          g   = 30,
          b   = 0,
          inc = 55;
        //System.out.println("labelSize = " + labelSize);
        for(int j = 0; j < squares.length; j++) {
          squares[j] = new JLabel("Square " + j, JLabel.CENTER);
          squares[j].setOpaque(true);
          squares[j].setPreferredSize(new Dimension(73, 73));
        // add labels
        int index = 0;
        gbc.gridx = 0;
        gbc.gridy = 0;
        for(int y = 0; y < 4; y++) {
          for(int x = 0; x < 4; x++) {
            index = y * 4 + x;
            squares[index].setBackground(new Color(r,g,b,90));
            gameBoard.add(squares[index], gbc);
            gbc.gridx++;
            r += inc;
          gbc.gridy++;
          gbc.gridx = 0;
          r = 90;
          g += inc;
        squares[9].setIcon(Unit.noUnit);
      public void show() {
        f.setVisible(true);
      public JLabel getLabel(int index) {
        return squares[index];
    }

  • Call a method of a class in a constructor of another class?

    Is this good programming or should i do it in another way?
    Consider an ordering system, where I have three classes, "Booking", "Table" and "Customer.
    My idea is to create a booking assigned to a table and a customer, the fields in the booking class is a Customer and a Table and the constructor assigns values to these field.
    In my Table class i have a method that books the table "bookTable(Customer customer)" and sets the availablility to 'false'.
    So my question is, is it good programming to call the method 'bookTable()' in the table class from the constructor of the Booking class? Or should i do it in another way?
    Edited by: DJHingapus on Jul 6, 2009 5:12 AM

    This sounds the wrong way around. What is the return value of bookTable(Customer)?
    I'd expect it to return a Booking object that it creates.
    Generally, you want the constructor to do as little as possible (while still only ever returning in a valid state, of course!).
    The problem you can get when you call other methods is that you introduce the possibility of other objects getting access to your object before the constructor has finished running (i.e. before the object is completely initialized). This can lead to nasty problems that are hard to find and debug.

  • Displaying the output from a java class executed from W/I another class

    I have compiled a java class, but I have run into a problem executing the class. I have read the posts and still have not solved the solution. I have tried to get the output of the Process by using "proc.getOutputStream().toString()", however it displays it in binary (ex. java.io.BufferOutputStream@48eb2067). If anyone can provide any assistance I would greatly appreciate it. Or if you could tell me if I'm on the right track or not. Thanks ALL. Here is a code segment:
    int truncStart = s.indexOf(".java");
                   s = s.substring(0,truncStart);
                   String[] command2 = {"java","c:/"+s};
                   try
                   //JOptionPane.showMessageDialog(null,"Exec. File "+s, "Exec. File : ",JOptionPane.ERROR_MESSAGE);
                   proc = Runtime.getRuntime().exec(command2);
                   JOptionPane.showMessageDialog(null,"Output: "+proc.getOutputStream().toString(),"Output"
    ,JOptionPane.ERROR_MESSAGE);
                   }

    You have to read the stream, like:
    InputStream stream = proc.getOutputStream();
    // now use methods on stream, such as read() to read the characters/lines - or wrap it in another line-friendly stream - see the java.io.* classes - keep reading until you get an end-of-stream indicator, depending on the API you end up using.

  • In java,how to trigger an event in one class from an event in another class

    i need sloution to thisbecause, when the swing components are colloborating each other,i need to control the components with respect to others events.

    eventListeners are the way to go.
    -Js

  • How to access an attribute(this is referencing to another class) in a class

    Dear Gurus,
    I have to read an attribute of a class and that attributes type another class.
    I have intantiated the class and my question is how to read the attribute. I know I can not dirrectly read the attribute since this is another class. I think I have to first reference the attribute right? Please advise me.
    My code looks like below:
    data: lo_fpm                                 type ref to if_fpm.
    data: lo_msg_mgr                        type ref to if_fpm_message_manager.
    data: lo_component_manager    type ref to cl_fpm_component_manager.
    lo_fpm = cl_fpm_factory=>get_instance( ).    " cl_fpm_factory is a class which has a static method get_instance
    lo_msg_mgr = lo_fpm->mo_message_manager.
    lo_component_manager = lo_fpm->mo_component_manager.
    The above statement is giving syntax error. I do not know why.
    The basic difference b/n the two methods is if_fpm~mo_message_manager    type ref to if_fpm_message_manager    and
    mo_component_manager     type ref to cl_fpm_component_manager.
    Any help would be appreciated.
    Thanks,
    GSM

    Hello
    I cannot test the following coding because I do not get the singleton instance yet it should work:
    *& Report  ZUS_SDN_CL_FPM_FACTORY
    *& Thread: How to access an attribute(this is referencing to another class) in a class
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1398429"></a>
    REPORT  zus_sdn_cl_fpm_factory.
    DATA: go_fpm TYPE REF TO cl_fpm.  " class implements if_fpm.
    DATA: go_msg_mgr TYPE REF TO if_fpm_message_manager.
    DATA: go_component_manager TYPE REF TO cl_fpm_component_manager.
    START-OF-SELECTION.
      BREAK-POINT.
      go_fpm ?= cl_fpm_factory=>get_instance( ). " cl_fpm_factory is a class which has a static method get_instance
      CHECK ( go_fpm IS BOUND ).
      go_msg_mgr           = go_fpm->mo_message_manager.
      go_component_manager = go_fpm->mo_component_manager.
    END-OF-SELECTION.
    Regards
      Uwe

  • Passing a parameter from one class to another class in the same package

    Hi.
    I am trying to pass a parameter from one class to another class with in a package.And i am Getting the variable as null every time.In the code there is two classes.
    i. BugWatcherAction.java
    ii.BugWatcherRefreshAction.Java.
    We have implemented caching in the front-end level.But according to the business logic we need to clear the cache and again have to access the database after some actions are happened.There are another class file called BugwatcherPortletContent.java.
    So, we are dealing with three java files.The database interaction is taken care by the portletContent.java file.Below I am giving the code for the perticular function in the bugwatcherPortletContent.java:
    ==============================================================
    public Object loadContent() throws Exception {
    Hashtable htStore = new Hashtable();
    JetspeedRunData rundata = this.getInputData();
    String pId = this.getPorletId();
    PortalLogger.logDebug(" in the portlet content: "+pId);
    pId1=pId;//done by sraha
    htStore.put("PortletId", pId);
    htStore.put("BW_HOME_URL",CommonUtil.getMessage("BW.Home.Url"));
    htStore.put("BW_BUGVIEW_URL",CommonUtil.getMessage("BW.BugView.Url"));
    HttpServletRequest request = rundata.getRequest();
    PortalLogger.logDebug(
    "BugWatcherPortletContent:: build normal context");
    HttpSession session = null;
    int bugProfileId = 0;
    Hashtable bugProfiles = null;
    Hashtable bugData = null;
    boolean fetchProfiles = false;
    try {
    session = request.getSession(true);
    // Attempting to get the profiles from the session.
    //If the profiles are not present in the session, then they would have to be
    // obtained from the database.
    bugProfiles = (Hashtable) session.getAttribute("Profiles");
    //Getting the selected bug profile id.
    String bugProfileIdObj = request.getParameter("bugProfile" + pId);
    // Getting the logged in user
    String userId = request.getRemoteUser();
    if (bugProfiles == null) {
    fetchProfiles = true;
    if (bugProfileIdObj == null) {
    // setting the bugprofile id as -1 indicates "all profiles" is selected
    bugProfileIdObj =(String) session.getAttribute("bugProfileId" + pId);
    if (bugProfileIdObj == null) {
    bugProfileId = -1;
    else {
    bugProfileId = Integer.parseInt(bugProfileIdObj);
    else {
    bugProfileId = Integer.parseInt(bugProfileIdObj);
    session.setAttribute(
    ("bugProfileId" + pId),
    Integer.toString(bugProfileId));
    //fetching the bug list
    bugData =BugWatcherAPI.getbugList(userId, bugProfileId, fetchProfiles);
    PortalLogger.logDebug("BugWatcherPortletContent:: got bug data");
    if (bugData != null) {
    Hashtable htProfiles = (Hashtable) bugData.get("Profiles");
    } else {
    htStore.put("NoProfiles", "Y");
    } catch (CodedPortalException e) {
    htStore.put("Error", CommonUtil.getErrMessage(e.getMessage()));
    PortalLogger.logException
    ("BugWatcherPortletContent:: CodedPortalException!!",e);
    } catch (Exception e) {
    PortalLogger.logException(
    "BugWatcherPortletContent::Generic Exception!!",e);
    htStore.put(     "Error",CommonUtil.getErrMessage(ErrorConstantsI.GET_BUGLIST_FAILED));
    if (fetchProfiles) {
    bugProfiles = (Hashtable) bugData.get("Profiles");
    session.setAttribute("Profiles", bugProfiles);
    // putting the stuff in the context
    htStore.put("Profiles", bugProfiles);
    htStore.put("SelectedProfile", new Integer(bugProfileId));
    htStore.put("bugs", (ArrayList) bugData.get("Bugs"));
    return htStore;
    =============================================================
    And I am trying to call this function as it can capable of fetching the data from the database by "getbugProfiles".
    In the new class bugWatcherRefreshAction.java I have coded a part of code which actually clears the caching.Below I am giving the required part of the code:
    =============================================================
    public void doPerform(RunData rundata, Context context,String str) throws Exception {
    JetspeedRunData data = (JetspeedRunData) rundata;
    HttpServletRequest request = null;
    //PortletConfig pc = portlet.getPortletConfig();
    //String userId = request.getRemoteUser();
    /*String userId = ((JetspeedUser)rundata.getUser()).getUserName();//sraha on 1/4/05
    String pId = request.getParameter("PortletId");
    PortalLogger.logDebug("just after pId " +pId);  */
    //Calling the variable holding the value of portlet id from BugWatcherAction.java
    //We are getting the portlet id here , through a variable from BugWatcherAction.java
    /*BugWatcherPortletContent bgAct = new BugWatcherPortletContent();
    String portletID = bgAct.pId1;
    PortalLogger.logDebug("got the portlet ID in bugwatcherRefreshAction:---sraha"+portletID);*/
    // updating the bug groups
    Hashtable result = new Hashtable();
    try {
    request = data.getRequest();
    String userId = ((JetspeedUser)data.getUser()).getUserName();//sraha on 1/4/05
    //String pId = (String)request.getParameter("portletId");
    //String pId = pc.getPorletId();
    PortalLogger.logDebug("just after pId " +pId);
    PortalLogger.logDebug("after getting the pId-----sraha");
    result =BugWatcherAPI.getbugList(profileId, userId);
    PortalLogger.logDebug("select the new bug groups:: select is done ");
    context.put("SelectedbugGroups", profileId);
    //start clearing the cache
    ContentCacheContext cacheContext = getCacheContext(rundata);
    PortalLogger.logDebug("listBugWatcher Caching - removing markup content - before removecontent");
    // remove the markup content from cache.
    PortletContentCache.removeContent(cacheContext);
    PortalLogger.logDebug("listBugWatcher Caching-removing markup content - after removecontent");
    //remove the backend content from cache
    CacheablePortletData pdata =(CacheablePortletData) PortletCache.getCacheable(PortletCacheHelper.getUserHandle(((JetspeedUser)data.getUser()).getUserName()));
    PortalLogger.logDebug("listBugWatcher Caching User: " +((JetspeedUser)data.getUser()).getUserName());
    PortalLogger.logDebug("listBugWatcher Caching pId: " +pId);
    if (pdata != null)
    // User's data found in cache!
    PortalLogger.logDebug("listBugWatcher Caching -inside pdata!=null");
    pdata.removeObject(PortletCacheHelper.getUserPortletHandle(((JetspeedUser)data.getUser()).getUserName(),pId));
    PortalLogger.logDebug("listBugWatcher Caching -inside pdata!=null- after removeObject");
    PortalLogger.logDebug("listBugWatcher Caching -finish calling the remove content code");
    //end clearing the cache
    // after clearing the caching calling the data from the database taking a fn from the portletContent.java
    PortalLogger.logDebug("after clearing cache---sraha");
    BugWatcherPortletContent bugwatchportcont = new BugWatcherPortletContent();
    Hashtable httable= new Hashtable();
    httable=(Hashtable)bugwatchportcont.loadContent();
    PortalLogger.logDebug("after making the type casting-----sraha");
    Set storeKeySet = httable.keySet();
    Iterator itr = storeKeySet.iterator();
    while (itr.hasNext()) {
    String paramName = (String) itr.next();
    context.put(paramName, httable.get(paramName));
    PortalLogger.logDebug("after calling the databs data from hashtable---sraha");
    } catch (CodedPortalException e) {
    PortalLogger.logException("bugwatcherRefreshAction:: Exception- ",e);
    context.put("Error", CommonUtil.getErrMessage(e.getMessage()));
    catch (Exception e) {
    PortalLogger.logException("bugwatcherRefreshAction:: Exception- ",e);
    context.put(     "Error",CommonUtil.getErrMessage(ErrorConstantsI.EXCEPTION_CODE));
    try {
    ((JetspeedRunData) data).setCustomized(null);
    if (((JetspeedRunData) data).getCustomized() == null)
    ActionLoader.getInstance().exec(data,"controls.EndCustomize");
    catch (Exception e)
    PortalLogger.logException("bugwatcherRefreshAction", e);
    ===============================================================
    In the bugwatcher Action there is another function called PostLoadContent.java
    here though i have found the portlet Id but unable to fetch that in the bugWatcherRefreshAction.java . I am also giving the code of that function under the bugWatcherAction.Java
    ================================================
    // Get the PortletData object from intermediate store.
    CacheablePortletData pdata =(CacheablePortletData) PortletCache.getCacheable(PortletCacheHelper.getUserHandle(
    //rundata.getRequest().getRemoteUser()));
    ((JetspeedUser)rundata.getUser()).getUserName()));
    pId1 = (String)portlet.getID();
    PortalLogger.logDebug("in the bugwatcher action:"+pId1);
    try {
    Hashtable htStore = null;
    // if PortletData is available in store, get current portlet's data from it.
    if (pdata != null) {
    htStore =(Hashtable) pdata.getObject(     PortletCacheHelper.getUserPortletHandle(
    ((JetspeedUser)rundata.getUser()).getUserName(),portlet.getID()));
    //Loop through the hashtable and put its elements in context
    Set storeKeySet = htStore.keySet();
    Iterator itr = storeKeySet.iterator();
    while (itr.hasNext()) {
    String paramName = (String) itr.next();
    context.put(paramName, htStore.get(paramName));
    bugwatcherRefreshAction bRefAc = new bugwatcherRefreshAction();
    bRefAc.doPerform(pdata,context,pId1);
    =============================================================
    So this is the total scenario for the fetching the data , after clearing the cache and display that in the portal.I am unable to do that.Presently it is still fetching the data from the cache and it is not going to the database.Even the portlet Id is returning as null.
    I am unable to implement that thing.
    If you have any insight about this thing, that would be great .As it is very urgent a promt response will highly appreciated.Please send me any pointers or any issues for this I am unable to do that.
    Please let me know as early as possible.
    Thanks and regards,
    Santanu Raha.

    Have you run it in a debugger? That will show you exactly what is happening and why.

  • Call from another class

    I have alot of lines that call setter methods. Anyway to put this all in another class and call it so I dont have to list all these in my current class?
    PersonClass chalk = new PersonClass();
    chalk.setHeight(request.getParameter("height"));
    chalk.setWeight(request.getParameter("weight"));
    chalk.setCountry(request.getParameter("country"));
    chalk.setLanguage(request.getParameter("language"));
    chalk.setExperience(request.getParameter("experience"));
    chalk.setLevel(request.getParameter("level"));
    .......//goes on for 20 more lines
    ...

    PersonClass chalk = new PersonClass();
    chalk.setHeight(request.getParameter("height"));
    chalk.setWeight(request.getParameter("weight"));
    chalk.setCountry(request.getParameter("country"));
    chalk.setLanguage(request.getParameter("language"));
    chalk.setExperience(request.getParameter("experience")Welcome to Java.

  • Compiling a class from another class

    is it possible to compile a class from the code in another class?
    i.e I want to check whether code in a .java file will compile before I use it.
    Is there any methods that I could use to do this and could anyone give me advice on HOW to use the methods suggested?
    thanks in advance
    david

    i was looking at that but it seems to only run files, not commands
    is there a way to use it with command.com or cmd.exe or something to send commands to it?
    also if i used a readline on an inputstream it only returned the first line (i tried running a batch file so the only line it returned was ..> javac testscript.java but i spose if i put
    @echo off
    javac testscript.java
    if exist testscript.class (
    echo compiled correctly
    ) else (
    echo compiled incorectly
    so the first line returned would either be "compiled correctly" or the compile error, but this would be compiling it to see if it compiles so im not sure if this answers the first question anyway =p

  • Assigning object of one class to object of another class.

    Hi,
    How will i assign an object of one class to an object of another class?
    Ex:
    ClassX A=some_method();
    Now how will I assign the object A of class ClassX to the object 'B' of another class 'ClassY'.

    In java you can only assign a object reference of one class into object reference of another class if the first class is the Second class (in other words the first class is a subclass of second class).
    for example if this is a inheritance chart
    Car ==========>Mercedes
    "===========>Audi
    then you can use
    Audi a1 = new Audi();
    Car c1 = a1;
    or Mercedes m1 = new Mercedes();
    Car c1 = m1;
    but not
    a1 = m1;
    before assigning a variable into another variable of different class, use:
    if(variable1 instanceOf ToBeAssignedIn Class){
    variable2 = variable1;
    example:
    Audi a1;
    Car c1;
    if(a1 instanceOf Car){
    c1 = a1;
    Edited by: gaurav.suse on Apr 10, 2012 1:14 PM
    Edited by: gaurav.suse on Apr 10, 2012 1:15 PM

Maybe you are looking for

  • IDOC-XI-JDBC scenario,   jdbc sent too slow

    i have a IDOC-XI-JDBC scenario, the problem is that near 5 Lac IDOC is sent to XI, each IDOC is processes by an instance of the scenario, and the sent to the Database is too clow...means 4000 records per hour, can i configure the JDBC receiver adapte

  • Restore 8GB iPod Touch

    My original computer has crashed and I have forgotten what my 4 digit code is, how do I restore my 8GB iPod touch back to factory settings so I can start all over? Any help is greatly appreciated!

  • How to use cancan life 500F with 10.9.1

    Apparently Canon does not have an updated driver for it's Canoscan LIDE 500F model for the latest Mac OS.  I've downloaded VueScan, but apparently I still need a Canon driver.  Does anyone know which driver to download?  And where do I go from there?

  • IOS 6 keeps asking for password to update apps when it shouldn't.  Is it my phone?

    Isn't updating apps supposed to not require an iTunes password anymore in iOS 6?  I thought that was the case, but my iPhone 4 keeps asking for one when there is an update available.  Does anybody know what to do besides restoring?  Anyone else havin

  • Installed JRE 7 not showing up on java prefrences?

    I have a 13-inch macbook pro with mountain lion. I installed JRE 7 and its not showing up on the java prefrences. only JRE 6.