Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 11-03-2010
Member
 
Join Date: Mar 2010
Posts: 200
Problem with Inner classes

Hello,
I exercise very easy to achieve, create two different classes, compile and test the program. Until the whole works, then I do one of two class an inner class of another and get the same result. That is what I have been trying to do, but I have no correct method and my every try is unsuccessfully compiled. So, any help on this will be appreciated.
Reply With Quote
  #2  
Old 11-03-2010
Member
 
Join Date: Dec 2009
Posts: 213
Re: Problem with Inner classes

Hello,
I think you can try the following
Code:
BasicArray a =new BasicArray();
But I do not think that you can access the method of the inner class from the above line code, even I have a very less idea about it. If you come to now about the exact solution for this then please even let me know about the same.
Reply With Quote
  #3  
Old 11-03-2010
Member
 
Join Date: Nov 2009
Posts: 343
Re: Problem with Inner classes

Hello,
You must declare your class as static , this will be good for your code
Here is the syntax for it
Code:
Public static class example {
The class call for you from the main function is static, make an inner class to call a function from the static. I think from this you can get an general idea of how the inner classes are used and for what purpose.
Reply With Quote
  #4  
Old 11-03-2010
Member
 
Join Date: Nov 2009
Posts: 330
Re: Problem with Inner classes

Hello,
I think you can do this in your program.
Code:
A = fac new fac(thisArray[i]);
If this is not helpful then you can post back with your exact need and the error you are getting so that we can help you out.
Reply With Quote
  #5  
Old 11-03-2010
Member
 
Join Date: Mar 2010
Posts: 200
Re: Problem with Inner classes

Hello,
Yes thank you, I had put the class static. I have difficulty in understanding the principle of static class. I think the problem is quite solved now, but the static keyword is really giving me a issue in understanding the things. If you can explain me the static keyword with an example then it would be great. Thanks in advance.
Reply With Quote
  #6  
Old 11-03-2010
Member
 
Join Date: Nov 2009
Posts: 446
Re: Problem with Inner classes

Hello,
Some information on the static keyword, here is a sample code
Code:
class mutl {
    . . .
   
    public static double mean(int[] x) {
        int s = 0;  // s of all the elements
        for (int i=0; i<x.length; i++) {
            s += x[i];
        }
        return ((double)s) / x.length;
    }//endmethod mean
    . . .
}
Hope this will help you.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Problem with Inner classes"
Thread Thread Starter Forum Replies Last Post
What are an Autoloading Classes in PHP? Flaco Software Development 5 06-03-2010 06:49 AM
Communication between two classes ANSEL Software Development 4 04-12-2009 06:43 PM
Sealed Classes in C# Reegan Software Development 5 27-11-2009 09:16 AM
C # using classes in C + + klite Software Development 3 01-10-2009 10:15 AM
Classes in VB.NET Samir_1 Software Development 2 10-04-2009 12:07 AM


All times are GMT +5.5. The time now is 09:34 AM.