Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!

jon ninpoja

Ranch Hand
+ Follow
since Jul 25, 2016
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by jon ninpoja

Daniel "If you want to be able to acces the getMethod without initializing the class, you should declare the method static, not the variable, but in this case I wouldn't."

so whats the alternative?
1 week ago
thanks fred yes that makes sense
thanks all,will try a few things tomorrow
1 week ago
Hey Vishal,

Dont be afraid,you are obviously good at your job and enjoy where you are...dont let one bad experience bring you down...i think you missing the golden opportunity..i would kill to be where you are,im only starting a software degree at the end of this year.
chin up,if you want to do it i dont think anything can stop you...but you have to ask yourself the question...and be honest with yourself.
1 week ago
i added this method:

to TeamManager

and this instance variable
ArrayList<String> teamList = new ArrayList<String>();

but in this code:

TeamManager.getTeamList method is not can i have it use methods of a class without instantiating the class? surely the arraylist has to be static...or have i got something wrong?

1 week ago
ok so here is what i have so far:

ignore the commented out code that was my object creation from user input,it works but i need to assemble this program better now.

in the TeamManager class i have a static int variable that will keep track of how many teams have been created

in the TeamManager class i will have the various methods to add a team,minus a team etc etc

ok so a few questions:

where would the best place be to put the arraylist?

shouldnt it be a static arraylist with static methods accessing the arraylist as it will be created and will always keep it in memory and make it available from everywhere in the program?
as what happens when somebody lists a team,and havent created a team yet...the arraylist needs to be initialised first but if i do that in a local scope it wont be able to be used later in the program

thanks for reading looking forward to feedback...

1 week ago
should my array list that will contain all my teams be static? would that make sense?
1 week ago
is factory method the same as factory design pattern...are factory methods just part of the factory design pattern? just watching a video on factory design patterns?
1 week ago
ok so daniel just to clarify

i want to have a menu

1) list all teams
2) Add team
3) remove team
3) quit

so i will need methods

quit can just be done from the menu

do those methods go in another class called LeagueTable for example,
then the Team class can take in the parameter as a name...i dont know i feel lost

1 week ago
very interesting thanks guys...

no this particular project is only about soccer teams so no need to elaborate too much just trying to get some key concepts down that i imagine would be useful
would it be necessary to have a clubs class then a sub class teams off that...would it make it more flexible and extensive down the line?

2 weeks ago
sorry guys...yes im jumping the gun a bit...will focus on the Team class and get that working first...sorry again
2 weeks ago
could listing the teams in the arraylist be a static method? or should this always be avoided? and...why?
2 weeks ago
"The creating of the object and the aadding to the list I would do in my main. "

shouldnt it be in a method what if a want to add,delete,list the teams in my arraylist...isnt that awkward from just main?

Campbell...i didnt really understand your technical description there...well i did s bit...just not the practical application.
2 weeks ago
Hey Campbell is a public constructor just a constructor or is it a special constructor no I have had no experience with factory methods but I will read up on it... So first thing to instantiate team objects?  That should be very easy as there is no data yet... All I want is a user created team name to create the associated object and put it in an array list... As always thanks for your help guys..
2 weeks ago
thanks daniel yes...i agree was just toying with the idea...ii have done all the basics but am battling to string things together
which is the better way to do things in the constructor or with getters and setters or does it not really matter in this situation?
2 weeks ago
hi guys

im trying to create a simple program to take a team name from a user,create the object and add it to an arraylist but im finding it harder than i thought

could an object be created from a method within the object im trying to instantiate?

heres what i have so far...but im finding actual design...of how things all fit together a problem.

can i have a method in a class create an object and put it into an arraylist?

can somebody just quickly outline how this should be setup...please
2 weeks ago