DaneAU's Profile
Reputation: 278
Architect
- Group:
- Contributor w/DIC++
- Active Posts:
- 1,587 (0.87 per day)
- Joined:
- 15-May 08
- Profile Views:
- 24,843
- Last Active:
May 21 2013 03:15 PM- Currently:
- Offline
Previous Fields
- Country:
- AU
- OS Preference:
- Linux
- Favorite Browser:
- Chrome
- Favorite Processor:
- Intel
- Favorite Gaming Platform:
- PC
- Your Car:
- Who Cares
- Dream Kudos:
- 225
Latest Visitors
-
darek9576 
18 Mar 2013 - 16:14 -
SarumanTheWhite 
23 Jan 2013 - 13:58 -
CY5 
23 Dec 2012 - 04:58 -
Crunch 
21 Nov 2012 - 08:30 -
giggly kisses 
29 Oct 2012 - 18:10 -
akocNivek 
20 Oct 2012 - 17:18 -
Naran kutty 
29 Sep 2012 - 03:25 -
rangerofthewest 
12 Sep 2012 - 07:43 -
AnalyticLunatic 
10 Sep 2012 - 09:15 -
blackcompe 
08 Sep 2012 - 19:00
Posts I've Made
-
In Topic: Abstract and inheritance help
Posted 26 Apr 2013
Oops you forget ever to add the objects into the ArrayList.
import java.util.ArrayList; public class PersonTester { public static void main(String[] args) { Man man = new Man(); Woman woman = new Woman(); ArrayList<Person> pArray = new ArrayList<Person>(); for(Person p : pArray) { p.printGender(); } } }
Should become...
import java.util.ArrayList; public class PersonTester { public static void main(String[] args) { Man man = new Man(); Woman woman = new Woman(); ArrayList<Person> pArray = new ArrayList<Person>(); pArray.add(man); // added pArray.add(woman); // added for(Person p : pArray) { p.printGender(); } } } -
In Topic: Is it bad design to call a method in a constructor?
Posted 23 Apr 2013
If you have implemented methods to encapsulate your data within a class and keep things private then you definitely should use this methods. Consider if a set method did something like truncate a string, how would you account for this in the constructor? reimplement the code in there?
class Example { private String databaseField; public Example(String databaseField) { this.setDatabaseField(databaseField); } public void setDatabaseField(String str) { this.databaseField = str.substring(0,10); // limit 10 chars } public void getDatabaseField() { return this.databaseField; } }
Whilst this is just an example, what it means is that any changes required for assignment of a member variable can be delegated to the set method, as a result if all calls for assignment use this method then there is one point only that requires change should the variables policy need to be adjusted. This is preferable under almost all circumstances. -
In Topic: Inheritance Problem
Posted 20 Mar 2013
Because your third class is not extending any class.
class third { // foo };
Should be either as you intend
class third : public base { // foo }; // or perhaps class third : public derived { // foo }; -
In Topic: Looping quirk
Posted 18 Mar 2013
From memory you could try using the delimiter property of the Scanner to ensure that the line is utilised.
Try something along the lines of Scanner in = new Scanner(System.in).useDelimiter("\n");
see here -
In Topic: Arghh, what have i omitted
Posted 27 Feb 2013
Thanks for the tip Dormilich it is most appreciated. I will read up on implementing this into my code.
Regards
My Information
- Member Title:
- Great::Southern::Land
- Age:
- 28 years old
- Birthday:
- August 4, 1984
- Gender:
-
- Location:
- Australia
- Interests:
- Surfing, coding and chillin out
- Full Name:
- Dane Leckey
- Years Programming:
- 3
- Programming Languages:
- Java, C, C++, C#, PHP, SQL, Perl, Haskel umm probably more, some ruby for good measure.
Contact Information
- E-mail:
- Click here to e-mail me
- MSN:
-
dane.leckey@gmail.com
- Website URL:
-
http://www.techturf.com.au
- Skype:
-
dane.leckey
- LinkedIn:
- http://www.linkedin.com/pub/dane-leckey/4b/b46/576
- Facebook:
- http://www.facebook.com/dane.leckey
- Twitter:
- Dane_AU
|
|


Find Topics
Find Posts
View Reputation Given



|
Comments
fromTheSprawl
30 Sep 2011 - 01:55fromTheSprawl
29 Sep 2011 - 23:41fromTheSprawl
28 Sep 2011 - 23:44atlu
06 Dec 2010 - 09:51Alex6788
17 Nov 2010 - 08:59DaneAU
19 Feb 2010 - 21:48Raynes
17 Feb 2010 - 01:53