An nested class has access to the variables and methods of its enclosing class, and it can be private to the enclosing class. That's a completely different kind of sharing and encapsulation compared to a separate class. Which you chose depends on what you need.
Consider a Listener class in Swing. You want it to have access to the components of the GUI, but you don't want anyone lese messing with it.
Most situations call for an ordinary class.
Nested classes are good for event listeners, and for little data structures used inside a class, eg Linked List classes may have an inner Entry class that encapsulates the data and the link. Just ask the two questions:
Is this class needed outside the main class?
Does this class need access to the main class's variables?
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...
Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...