• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

How to create classes in another class properly

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone at coderanch!

My question is poorly worded and I apologies for that. I was not to sure how to ask this question.

I have been learning java for almost a year now and can do everything I want to at this point. However I am stuck on a few things in terms of how to correctly do them.

One of my classes named teacher has a method as below:

   

There is currently no need for the other methods as my question is about the way I code. I create two suspects and present them to the player.

Whilst doing my unit testing I noticed that testing the chooseWhoDidIt() method to test if the suspects information were correctly pulled from the database just felt wrong. I feel like I should have a separate method that deals with the creation of the suspects.

That brings me to my second question. If I do make a second method that creates suspects, would it make sense to even have that method in the Teacher class?

I am more then happy to recieve any other input to help me better my practises. That is what I would like to focus on for the new few weeks/months.

Thank you all!
 
No matter. Try again. Fail again. Fail better. This time, do it with this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic