Tagged Questions
-1
votes
0answers
30 views
Is it possible to move variable's values from one class to another class without inheritance in java? [migrated]
I have learnt how to call methods and even variables between two classes. I wanted to know if you can move values from one class to another without using inheritance. Here is an example:
I create ...
1
vote
3answers
96 views
When to store values in constants/finals
This might seem like an odd question, but I'm worried that I'm putting too many things as constants/finals at the top of my java class. I've started to put every value that is in my program into a ...
1
vote
1answer
100 views
Designing a list class with filtering and sorting
The app I'm developing needs to display lists of items. Simple enough, but there are a number of things which can change based on user input:
Items can be added to/removed from the list.
The items ...
16
votes
9answers
1k views
Isn't class scope purely for organization?
Isn't scope just a way to organize classes, preventing outside code from accessing certain things you don't want accessed?
More specifically, is there any functional gain to having public, protected, ...
3
votes
6answers
2k views
How to properly design classes for a big project?
If we need to represent classes in a class diagram for a big project that is not completely designed yet, and the classes have to be actual tables in a database, how would we predict and design the ...
4
votes
3answers
139 views
What class structure allows for a base class and mix/match of subclasses? (Similar to Users w/ roles)
I have a set of base characteristics, and then a number of sub-types. Each instance must be one of the sub-types, but can be multiple sub-types at once. The sub-types of each thing can change. In ...
5
votes
5answers
603 views
Prefer class members or passing arguments between internal methods?
Suppose within the private portion of a class there is a value which is utilized by multiple private methods. Do people prefer having this defined as a member variable for the class or passing it as ...
