|
||||||
| Java Help Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
I thank you for any help you can give with this exercise.
I am reading about user-defined classes and ADT's for the first time. This exercise asks me to create a UML diagram for a class called MyDate that contains data memebers and a constructor that meet the criteria for the following list. This class is used to initialize instance variables. The nonstatic integer data members named month, day, and year should be private members so that they cannot be directly manipulated outside of the class. The nonstatic Boolean data member named good should be a public member so that it can be accessed outside of the class. The constructor MyDate() should assign to the member variables the values 1 to month, 1 to day, 2006 to year, and the value true to good. Would the constructor look like this? +MyDate() +MyDate(1, 1, 2006, true) So far I have ______________ MyDate ______________ -month: int -day: int -year: int +good: int _______________ +MyDate() +MyDate(1,1,2006,true) Thank you |
| Sponsored Links |
|
|
|
|||||
|
Basically, YES. Remove the plus symbol and it should work.
I'm not 100% sure what your wanting to do but heres my thoughts. Note, the code is examples only and would need minor adapting to your situation. Java Code:
As you should be able to see, the basic answer is yes, depending on how you want to use it. Hope this helps! Domestic
__________________
. ![]() Programming Languages: Java, VB6, VB2005 (.NET2) Web Languages: HTML, CSS, JS Website: http://abdn.ac.uk/~u41am6 Opportunity is missed by most people because it is dressed in overalls and looks like work. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Issue writing to file: pointer to a class which contains pointers to other classes | Sheemer | C and C++ | 0 | 08-21-2007 02:17 AM |
| Abstract Classes | CyberByte | C and C++ | 1 | 02-21-2007 07:22 PM |
| Data and Classes | Sionofdarkness | Java Help | 5 | 08-23-2006 10:18 PM |
| Classes, Methods, and Objects | Sionofdarkness | Java Help | 6 | 08-21-2006 01:55 PM |
| understanding classes | Chan | C# Programming | 3 | 07-17-2006 01:19 AM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |