How to make an object of inner class and use it ?

Hi tecs,
In my JSF application i have a need to make an inner member class in one of my bean class.
How can i make the object of this class?(what should be the entry in faces-config)
And there are text box and check box (in the JSP) associated with the elements of this inner class. What should be the coding in JSP so that elements in the JSP can be linked with the corresponding members of the inner class ?
Plz help.
Thnx in advance.

Hi
I am havin 10 text boxes in my application.
But out of 10 , 3 will be always together(existence of one is not possible without the other two.)
Now i want to create a vector of objects ( here object will consist of the value corresponding to these three boxes),there can be many elements in this vector.
So i m thinking to make an inner class which have three String variables corresponding to these text boxes that exists together.
What can b done ?

Similar Messages

  • How to make versionable object of different class than Document?

    In the programmers reference is that every PublicObject can be versioned, but there are only samples for versioning documents. I would like to keep history on folder hierarchy changes, so I think I need a Folder that can be versioned.
    The question is how to do this?
    Should I override isVersionable method in subclass of Folder to return true?
    Please help

    Hi
    I am havin 10 text boxes in my application.
    But out of 10 , 3 will be always together(existence of one is not possible without the other two.)
    Now i want to create a vector of objects ( here object will consist of the value corresponding to these three boxes),there can be many elements in this vector.
    So i m thinking to make an inner class which have three String variables corresponding to these text boxes that exists together.
    What can b done ?

  • How to create an object of inner class

    hi i don't know how to create an object of an inner class..
    i got something like
    class Abc{
    private class Abcd {
    like this and i want to create an object of Abcd so that i can use some of method
    there..
    i think i should create the outter class object first right? but not sure
    the syntax.. i tried something like
    Abc.Abcd justTry = new Abc.Abcd()
    something like this..but not work..
    help me plz. ...

    If the nested class (that's not technically an inner
    class you have there) is not static, then you can't
    refer to it with OuterClassName.InnerClassName any
    more than you can refer to any other member--method
    or variable--with ClassName.staticMember.
    You need an instance.
    It's been a while since I've created an instance of a
    non-static nested class from outside that clsas, but
    I think it's something like this: Outer outer = new Outer();
    outer.Inner inner = new outer.Inner();
    Actually, I think it is this:
      Outer outer = new Outer();
      outer.Inner inner = outer.new Inner();Can't test it now though, gotta go to Taco John's for TACO TUESDAY!!!!
    Gotta love them crunchy shell bean tacos!!!

  • How to make a object of Directory Class

    hi
    i want to pass the value "C:\\opt\\lucene\\didyoumean\\indexes\\spell" to the "spellIndexDirectory"
    here is my code
    package org.tiling.didyoumean;
    import java.io.IOException;
    import org.apache.lucene.index.Term;
    import org.apache.lucene.queryParser.ParseException;
    import org.apache.lucene.search.Query;
    import org.apache.lucene.search.TermQuery;
    import org.apache.lucene.search.spell.SpellChecker;
    import org.apache.lucene.store.Directory;
    class spell{
         public static void main(String args[]){
              System.out.println("hi");
              Directory spellIndexDirectory = new Directory("C:\\opt\\lucene\\didyoumean\\indexes\\spell");
              SpellChecker spellChecker = new SpellChecker(spellIndexDirectory);
              String[] similarWords = spellChecker.suggestSimilar("jva", 1);
              System.out.println("the suggestion is"+ similarWords[0]);
    this way it gives me this errorC:\Documents and Settings\sumit-i\Desktop\didyoumean\didyoumean-1.0\src\java>javac org/tiling/didyoumean/spell.java
    org\tiling\didyoumean\spell.java:17: org.apache.lucene.store.Directory is abstract; cannot be instantiated
    Directory spellIndexDirectory = new Directory("C:\\opt\\lucene\\didyoumean\\indexes\\spell");
    ^
    1 error
    how can i resolve this issue......i am not getting how to pass value to the Directory....
    any idea please....                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    You can't instantiate abstract objects. When you need an object of an abstract class, you actually end up with an object of a (non-abstract, a.k.a. "concrete") class. You get those in one of these ways:
    1) the abstract class might have a static method that gives you an object of a subclass
    2) there might be a different class that has a method (static or not) that gives you an object of the first abstract class.
    3) there are subclasses in the API that you can instantiate directly.
    As already suggested, re-read the docs.

  • How to make an object mutable?

    Can any one tell me how to make an object mutable?
    Following is Class X & Y?
    class Y
    public static void main(String arg[]) {
    X a1=new X();
    Object a=a1.get();
    System.out.println(a.toString());
    a1.set(a);
    System.out.println(a.toString());
    class X implements Serializable
    public Object get(){
    return new Object();
    public synchronized void set(Object o)
    o=null;
    In my class Y when i say
    a1.set(a);
    I want local Object a of main method should be nullified.
    Can it be possible if yes what is the way or code to be applied so that
    my next a.toString() statement will give me NullpointerException.

    Isn't it more accurate to say that object references are passed by value?
    OP -- Basically you can't to what you want to do. When you "pass an object" as a method parameter, what you're really passing is a copy of the reference that points to the object. You now have two refs pointing to the same object--one in the caller and one in the method being executed. Setting either of those refs to null does NOT affect the object itself, and does NOT affect the other ref. It just means that the ref that's been set to null no longer points to any object.
    If you want the called method to make a change that the caller can see, you need to either 1) return a value from the method, 2) encapsulate the object to be changed as a member of new class, or 3) pass the object to be changed as the single element of an array. I would STRONGLY recommend against (3) as a way to simulate pass by reference. Better to examine your design and determine whether (1) or (2) more closely matches what you're really trying to accomplish.

  • How to make an object distributed across multiple jres?

    Hi,
    We used cache data mechanism for performance tuning. It will store data in static variable (Hashtable) and get initialized when app starts . We are using IPlanet Application Server and
    Using 6 KJS engines. This object ( Hashtable) is not distributed across all JRES.It has to reinitialize data again when request goes to any other KJS.
    We avoid sharing data in session and request, as data is huge.
    Can any one help us how to make this object distributed across all KJSs?
    Thanks in advance.
    raj

    We used cache data mechanism for performance tuning.
    It will store data in static variable (Hashtable) and
    get initialized when app starts.
    We are using IPlanet Application Server and
    Using 6 KJS engines. This object ( Hashtable) is not
    distributed across all JRES. It has to reinitialize
    data again when request goes to any other KJS.
    We avoid sharing data in session and request, as data
    is huge.
    Can any one help us how to make this object
    distributed across all KJSs?When you say 'initialized when app starts' do you mean iPlanets StartUp classes, rather than the Servlets init() ? Given a 'huge' dataset, avoid the latter.
    I'd suggest that a better approach is to implement this as an Entity Bean and accessed from Session bean and using Value Objects to return the data subsets.
    Checkout the Java Pet Store
    http://java.sun.com/blueprints/code/jps13/datasheet.html

  • How to make any object self-shining?

    hi,
    i guess thats an easy question, but i dont know where to look for the answer.
    so how to make any object self-shining like the infamous colorcube, so that one does not need to place any light?
    and am I right in my assumption that doing so will reduce the need of rendering power, since lights dont have to be computed?
    thanx,
    Usul

    I'm not sure what you mean here- if your object is lit then lighting will need to be calculated. If you don't want shapes to be lit, I think you can disable it by calling setLightingEnable(false) in their materials.

  • HOw to make an Object oriented alv respond to double click

    Hi all,
    HOw to make an Object oriented alv respond to double click.SAmple code will be helpful.
    Thanks in advance,
    Alex.

    Hi,
    1. Create a Control (for Custom and Split Containers only)
    2. Instantiate a Container Object (in case of Custom and Split Containers, specify the control which is created by us in Screen painter) CREATE OBJECT
    3. Instantiate an Object of the kind of report that has to be displayed (List, Grid or Tree). CREATE OBJECT . Here we need to specify the Parent Container as the so that it sits in that container.
    4. Call appropriate methods to display the report on the screen. CALL METHOD ->
    DATA : g_dock TYPE REF TO cl_gui_docking_container,
    g_split TYPE REF TO cl_gui_easy_splitter_container,
    g_cont1 TYPE REF TO cl_gui_container,
    g_cont2 TYPE REF TO cl_gui_container,
    g_grid1 TYPE REF TO cl_gui_alv_grid,
    g_grid2 TYPE REF TO cl_gui_alv_grid.
    i_mara is an internal table of structure MARA
    SELECT * FROM mara INTO TABLE i_mara.
    i_kna1 is an internal table of structure KNA1
    SELECT * FROM kna1 INTO TABLE i_kna1.
    To create an Object of type Docking Container
    CREATE OBJECT g_dock
    EXPORTING
    side = cl_gui_docking_container=>dock_at_top
    extension = 200 .
    To Create an Object of Type Split Container. Here we can see that the Docking *Container Created above has been used as a parent .
    CREATE OBJECT g_split
    EXPORTING
    parent = g_dock
    orientation = 1 .
    Easy Split container splits one Control into 2 manageable controls, each of them is used * to handle one GUI Container each
    g_cont1 = g_split->top_left_container.
    g_cont2 = g_split->bottom_right_container.
    To Create an Object of type Grid . Here we can see that the Left Split Container * Created above has been used as a parent .
    CREATE OBJECT g_grid1
    EXPORTING
    i_parent = g_cont1 .
    To Create an Object of type Grid . Here we can see that the Right Split Container * Created above has been used as a parent .
    CREATE OBJECT g_grid2
    EXPORTING
    i_parent = g_cont2 .
    The method of Grid Control Object is used to display the Data.
    CALL METHOD g_grid1->set_table_for_first_display
    EXPORTING
    i_structure_name = 'MARA'
    CHANGING
    it_outtab = i_mara[] .
    The method of Grid Control Object is used to display the Data.
    CALL METHOD g_grid2->set_table_for_first_display
    EXPORTING
    i_structure_name = 'KNA1'
    CHANGING
    it_outtab = i_kna1[] .
    Regards
    Hari

  • Main method not found and how to implement events in an inner class

    How would I put all the event handling methods in an inner class and I have another class that just that is just a main function, but when i try to run the project, it says main is not found. Here are the two classes, first one sets up everything and the second one is just main.
    mport java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class JournalFrame extends JFrame {
    private JLabel dateLabel = new JLabel("Date: ");
    private JTextField dateField = new JTextField(20);
    private JPanel datePanel = new JPanel(new FlowLayout());
    BorderLayout borderLayout1 = new BorderLayout();
    JPanel radioPanel = new JPanel();
    JPanel statusPanel = new JPanel();
    JPanel textAreaPanel = new JPanel();
    JPanel buttonPanel = new JPanel();
    GridLayout gridLayout1 = new GridLayout();
    FlowLayout flowLayout1 = new FlowLayout();
    GridLayout gridLayout2 = new GridLayout();
    GridLayout gridLayout3 = new GridLayout();
    JRadioButton personalButton = new JRadioButton();
    JRadioButton businessButton = new JRadioButton();
    JLabel status = new JLabel();
    JTextArea entryArea = new JTextArea();
    JButton clearButton = new JButton();
    JButton saveButton = new JButton();
    ButtonGroup entryType = new ButtonGroup();
    public JournalFrame(){
    try {
    jbInit();
    catch(Exception e) {
    e.printStackTrace();
    private void initWidgets(){
    private void jbInit() throws Exception {
    this.getContentPane().setLayout(borderLayout1);
    radioPanel.setLayout(gridLayout1);
    statusPanel.setLayout(flowLayout1);
    textAreaPanel.setLayout(gridLayout2);
    buttonPanel.setLayout(gridLayout3);
    personalButton.setSelected(true);
    personalButton.setText("Personal");
    personalButton.addActionListener(new JournalFrame_personalButton_actionAdapter(this));
    businessButton.setText("Business");
    status.setText("");
    entryArea.setText("");
    entryArea.setColumns(10);
    entryArea.setLineWrap(true);
    entryArea.setRows(30);
    entryArea.setWrapStyleWord(true);
    clearButton.setPreferredSize(new Dimension(125, 25));
    clearButton.setText("Clear Journal Entry");
    clearButton.addActionListener(new JournalFrame_clearButton_actionAdapter(this));
    saveButton.setText("Save Journal Entry");
    saveButton.addActionListener(new JournalFrame_saveButton_actionAdapter(this));
    this.setTitle("Journal");
    gridLayout3.setColumns(1);
    gridLayout3.setRows(0);
    this.getContentPane().add(datePanel, BorderLayout.NORTH);
    this.getContentPane().add(radioPanel, BorderLayout.WEST);
    this.getContentPane().add(textAreaPanel, BorderLayout.CENTER);
    this.getContentPane().add(buttonPanel, BorderLayout.EAST);
    entryType.add(personalButton);
    entryType.add(businessButton);
    datePanel.add(dateLabel);
    datePanel.add(dateField);
    radioPanel.add(personalButton, null);
    radioPanel.add(businessButton, null);
    textAreaPanel.add(entryArea, null);
    buttonPanel.add(clearButton, null);
    buttonPanel.add(saveButton, null);
    this.getContentPane().add(statusPanel, BorderLayout.SOUTH);
    statusPanel.add(status, null);
    this.pack();
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    private void saveEntry() throws IOException{
    if( personalButton.isSelected())
    String file = "Personal.txt";
    BufferedWriter bw = new BufferedWriter(new FileWriter(file,true));
    entryArea.getText();
    bw.write("Date: " + dateField.getText());
    bw.newLine();
    bw.write(entryArea.getText());
    bw.newLine();
    bw.flush();
    bw.close();
    status.setText("Journal Entry Saved");
    else if (businessButton.isSelected())
    String file = "Business.txt";
    BufferedWriter bw = new BufferedWriter(new FileWriter(file,true));
    bw.write("Date: " + dateField.getText());
    bw.newLine();
    bw.write(entryArea.getText());
    bw.newLine();
    bw.flush();
    bw.close();
    status.setText("Journal Entry Saved");
    void clearButton_actionPerformed(ActionEvent e) {
    dateField.setText("");
    entryArea.setText("");
    status.setText("");
    void saveButton_actionPerformed(ActionEvent e){
    try{
    saveEntry();
    }catch(IOException error){
    status.setText("Error: Could not save journal entry");
    void personalButton_actionPerformed(ActionEvent e) {
    class JournalFrame_clearButton_actionAdapter implements java.awt.event.ActionListener {
    JournalFrame adaptee;
    JournalFrame_clearButton_actionAdapter(JournalFrame adaptee) {
    this.adaptee = adaptee;
    public void actionPerformed(ActionEvent e) {
    adaptee.clearButton_actionPerformed(e);
    class JournalFrame_saveButton_actionAdapter implements java.awt.event.ActionListener {
    JournalFrame adaptee;
    JournalFrame_saveButton_actionAdapter(JournalFrame adaptee) {
    this.adaptee = adaptee;
    public void actionPerformed(ActionEvent e) {
    adaptee.saveButton_actionPerformed(e);
    class JournalFrame_personalButton_actionAdapter implements java.awt.event.ActionListener {
    JournalFrame adaptee;
    JournalFrame_personalButton_actionAdapter(JournalFrame adaptee) {
    this.adaptee = adaptee;
    public void actionPerformed(ActionEvent e) {
    adaptee.personalButton_actionPerformed(e);
    public class JournalApp {
    public static void main(String args[])
    JournalFrame journal = new JournalFrame();
    journal.setVisible(true);
    }

    Here is the complete code (with crappy indentation) :
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class JournalFrame extends JFrame {
        private JLabel dateLabel = new JLabel("Date: ");
        private JTextField dateField = new JTextField(20);
        private JPanel datePanel = new JPanel(new FlowLayout());
        BorderLayout borderLayout1 = new BorderLayout();
        JPanel radioPanel = new JPanel();
        JPanel statusPanel = new JPanel();
        JPanel textAreaPanel = new JPanel();
        JPanel buttonPanel = new JPanel();
        GridLayout gridLayout1 = new GridLayout();
        FlowLayout flowLayout1 = new FlowLayout();
        GridLayout gridLayout2 = new GridLayout();
        GridLayout gridLayout3 = new GridLayout();
        JRadioButton personalButton = new JRadioButton();
        JRadioButton businessButton = new JRadioButton();
        JLabel status = new JLabel();
        JTextArea entryArea = new JTextArea();
        JButton clearButton = new JButton();
        JButton saveButton = new JButton();
        ButtonGroup entryType = new ButtonGroup();
        public JournalFrame(){
            try {
                jbInit();
            catch(Exception e){
                e.printStackTrace();
        private void initWidgets(){
        private void jbInit() throws Exception {
            this.getContentPane().setLayout(borderLayout1);
            radioPanel.setLayout(gridLayout1);
            statusPanel.setLayout(flowLayout1);
            textAreaPanel.setLayout(gridLayout2);
            buttonPanel.setLayout(gridLayout3);
            personalButton.setSelected(true);
            personalButton.setText("Personal");
            personalButton.addActionListener(new JournalFrame_personalButton_actionAdapter(this));
            businessButton.setText("Business");
            status.setText("");
            entryArea.setText("");
            entryArea.setColumns(10);
            entryArea.setLineWrap(true);
            entryArea.setRows(30);
            entryArea.setWrapStyleWord(true);
            clearButton.setPreferredSize(new Dimension(125, 25));
            clearButton.setText("Clear Journal Entry");
            clearButton.addActionListener(new JournalFrame_clearButton_actionAdapter(this));
            saveButton.setText("Save Journal Entry");
            saveButton.addActionListener(new JournalFrame_saveButton_actionAdapter(this));
            this.setTitle("Journal");
            gridLayout3.setColumns(1);
            gridLayout3.setRows(0);
            this.getContentPane().add(datePanel, BorderLayout.NORTH);
            this.getContentPane().add(radioPanel, BorderLayout.WEST);
            this.getContentPane().add(textAreaPanel, BorderLayout.CENTER);
            this.getContentPane().add(buttonPanel, BorderLayout.EAST);
            entryType.add(personalButton);
            entryType.add(businessButton);
            datePanel.add(dateLabel);
            datePanel.add(dateField);
            radioPanel.add(personalButton, null);
            radioPanel.add(businessButton, null);
            textAreaPanel.add(entryArea, null);
            buttonPanel.add(clearButton, null);
            buttonPanel.add(saveButton, null);
            this.getContentPane().add(statusPanel, BorderLayout.SOUTH);
            statusPanel.add(status, null);
            this.pack();
            setDefaultCloseOperation(EXIT_ON_CLOSE);
        private void saveEntry() throws IOException{
            if( personalButton.isSelected()){
                String file = "Personal.txt";
                BufferedWriter bw = new BufferedWriter(new FileWriter(file,true));
                entryArea.getText();
                bw.write("Date: " + dateField.getText());
                bw.newLine();
                bw.write(entryArea.getText());
                bw.newLine();
                bw.flush();
                bw.close();
                status.setText("Journal Entry Saved");
            else if (businessButton.isSelected()){
                String file = "Business.txt";
                BufferedWriter bw = new BufferedWriter(new FileWriter(file,true));
                bw.write("Date: " + dateField.getText());
                bw.newLine();
                bw.write(entryArea.getText());
                bw.newLine();
                bw.flush();
                bw.close();
                status.setText("Journal Entry Saved");
        void clearButton_actionPerformed(ActionEvent e) {
            dateField.setText("");
            entryArea.setText("");
            status.setText("");
        void saveButton_actionPerformed(ActionEvent e){
            try{saveEntry();}catch(IOException error){
                status.setText("Error: Could not save journal entry");
        void personalButton_actionPerformed(ActionEvent e) {
        class JournalFrame_clearButton_actionAdapter implements java.awt.event.ActionListener {
        JournalFrame adaptee;
        JournalFrame_clearButton_actionAdapter(JournalFrame adaptee) {
            this.adaptee = adaptee;
        public void actionPerformed(ActionEvent e) {
            adaptee.clearButton_actionPerformed(e);
    class JournalFrame_saveButton_actionAdapter implements java.awt.event.ActionListener {
        JournalFrame adaptee;
        JournalFrame_saveButton_actionAdapter(JournalFrame adaptee) {
            this.adaptee = adaptee;
        public void actionPerformed(ActionEvent e) {
            adaptee.saveButton_actionPerformed(e);
    class JournalFrame_personalButton_actionAdapter implements java.awt.event.ActionListener {
        JournalFrame adaptee;
        JournalFrame_personalButton_actionAdapter(JournalFrame adaptee) {
            this.adaptee = adaptee;
        public void actionPerformed(ActionEvent e) {
            adaptee.personalButton_actionPerformed(e);
    }BadLands

  • How to create an object of a class?

    plz read the question carefully ..
    how to create the object of a class by giving the class name as an String
    suppose i have a java file name:" java1.java ".
    so now how to create an object of this class "java1"by passing a string "java1"..

    kajbj wrote:
    rajeev-usendi wrote:
    thanks but still i have problem..
    i have created the object but now i m unable to do anything with that created object..
    i have coded like this..
    Object o= Class.forName("java1").new Instance();
    after this i m unable to do anything with the object 'o'..So why did you create the instance? You can also get all methods using reflection, but that is probably not what you want to do. You should instead let the class implement an interface and cast the created object into that interface ans call the methods that you want to call.
    KajI agree with Kaj. If you need to use a class that's unavailable at compile time, you should create an appropriate interface by which to refer to the class and then you create instances reflectively and access them normally via their interface (which is called reflective instantiation with interface access)

  • How to make Shape3D object translucent

    Hi,
    How to make Shape3D object (like Box, Cylinder) translucent? I tried the below option but the box is not becoming translucent at all.
    final PhongMaterial redMaterial = new PhongMaterial();
              redMaterial.setSpecularColor(Color.rgb(10, 255, 15, opacity));
              redMaterial.setDiffuseColor(Color.rgb(10, 255, 15, opacity));
    final Box box = new Box(width,height,depth);
    box.setMaterial(redMaterial);
    When opacity is 1, the color of the box will be Green, when it is 0 the color becomes black.
    Is there any way the box can be made translucent?

    There is at least one unresolved issue concerning PhongMaterial's transparency: RT-28874.
    I'm neither able to get it working properly. My red Sphere also fades to black while varying the opacity value from 1.0 to 0.0.
    August

  • What is inner class ,and how can I use it?thanks

    what is inner class ,and how can I use it?thanks

    Theres a whole chapter here http://developer.java.sun.com/developer/Books/certification/certbook.html (thanks to SSvetlana for pointing this one out).
    Col

  • Help: Factory Class using Inner Class and Private Constructor?

    The situation is as follows:
    I want a GamesCollection class that instantiates Game objects by looking up the information needed from a database. I would like to use Game outside of GamesCollection, but only have it instantiated by GamesCollection to ensure the game actually exist. Each Game object is linked to a database record. If a Game object exist, it must also exist in the database. Game objects can never be removed from the database.
    I thought about making the Game object an inner class of GamesCollection, but this means that Game class constructor is still visible outside. So what if I made Game constructor private? Well, now I can't create Game objects without a static method inside Game class (static Object factory).
    Basically what I need is a constructor for the inner Game class accessible to GamesCollection, but not to the rest of the world (including packages). Is there a way to do this?

    leesiulung wrote:
    As a second look, I was initially confused about your first implementation, but it now makes more sense.
    Let me make sure I understand this:
    - the interface is needed to make the class accessible outside the outer classBetter: it is necessary to have a type that is accessible outside of GameCollection -- what else could be the return type of instance?
    - the instance() method is the object factory
    - the private modifier for the inner class is to prevent outside classes to instantiate this objectRight.
    However, is a private inner class accessible in the outer class? Try it and see.
    How does this affect private/public modifiers on inner classes?Take about five minutes and write a few tests. That should answer any questions you may have.
    How do instantiate a GameImpl object? This basically goes back to the first question.Filling out the initial solution:
    public interface Game {
        String method();
    public class GameCollection {
        private static  class GameImpl implements Game {
            public String method() {
                return "GameImpl";
        public Game instance() {
            return new GameImpl();
        public static void main(String[] args) {
            GameCollection app = new GameCollection();
            Game game = app.instance();
            System.out.println(game.method());
    }Even if you were not interested in controlling game creation, defining interfaces for key concepts like Game is always going to be a good idea. Consider how you will write testing code, for example. How will you mock Game?

  • Private inner class and static private inner

    Hi,
    I understand the concept and usage of inner classes in general.
    When should we go for a private inner class and when for a static private inner class? I tried searching but it wasn't of much help.
    Basically I need to design a caching solution in which I need to timestamp the data object. After timestamping, data will be stored in a HashMap or some other collection. I'm planning to use a wrapper class (which is inner and private) which holds the data object and timestamp. I can make the program work by using either normal inner class or static inner class, however would like to know which is better in such case. Also If I can get some general guidelines as to when to use a staic inner class and when to use a normal inner class, it would help me.
    Thanks in advance.

    user1995721 wrote:
    When should we go for a private inner class and when for a static private inner class?
    I can make the program work by using either normal inner class or static inner class, however would like to know which is better
    If I can get some general guidelines as to when to use a static inner class and when to use a normal inner class, it would help me.Making the inner class static is helpful in that it limits visibility.
    If the inner class needs to access non-static fields or methods from the containing class instance
    the inner class has to be non-static.

  • Clarification about inner class - why use it?

    hi all
    i just have a request to get some clarification on inner class. why do we use it and is it common to use it? thanks.

    hi all
    i just have a request to get some clarification on
    inner class. why do we use it and is it common to use
    it? thanks.It is realtively common. You may use one if you need to implement a class that's only relevant to one other class, like a data container or EventListener. Since it's probably interlocking tightlyx with its "outer" class, but doesn't need to be in reach of any other classes, its visibility can be confined to the outer class itself. Plus, objects from inner classes - if not declared static - are always tied to the existance of an outer class instance.

Maybe you are looking for

  • Home Hub 4 No internet access

    Hi, I have had my hh4 for about five days, it works on all the other PCs and ipads etc except for the PC in the office. I have followed the instructions from the site, but when I get to the "choose a wireless connection" I get greeted with "windows c

  • Using a background image for the buttons in spry menu

    Hi All, Going nuts here. I'm using the vertical spry menu widget w DW CS3 and trying to alter the css style sheet, so that I can use a li class for each of the 14 links on this page, with an upstate and a hover state only. (the focus, and hover while

  • Officejet Pro 6830 Won't Print!!

    Hi, I have recently purchased an HP Officejet Pro 6830 and after being set up it just doesn't want to print.  I can't print a test page on it's own but with the HP Print and Scan Doctor it prints test pages. It can't print from any Microsoft Office 2

  • Flat File Hierarchy Datasources

    We are creating several flat file hierarchy datasources. The datasources will be maintained in an external database. I am familiar with the creation of flat file datasources for master and transactional data, but don't have good documentation for how

  • Hosted Email pages not displaying correctly

    Hello Ive tried searching this forum but didnt have any luck. My issue is this: I have a .Mac account and i usually make my newsletters for email in iWeb. I host it to my server space on .Mac. It displays correctly in Safari and even when i send it t