![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Feb 2005
Posts: 2
Rep Power: 0
![]() |
simple homework
I have porblem with homework..someone who know how to write it pleas help
Write a class that can be created only in a single instance and only by some specific method. For example this should work: SingleInstance pInst = SingleInstance.getInstance(); pInst.someMethod(); And this shouldn't: SingleInstance oneInstance = new SingleInstance(); oneInstance.someMethod(); The second call to getInstance() method should return the pointer to the already existing object and do not create a new one. Hints: private, public, static |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() |
have you tried any code yet. People around here don't do homework for people. Post your code, then people will help you.
We aren't a home work service.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Feb 2005
Posts: 2
Rep Power: 0
![]() |
sry but i have no idea how to start or to do it
![]() |
|
|
|
|
|
#4 |
|
Programming Guru
![]() ![]() |
i am pretty sure that your teracher showed you how to write a class. If you still don't know, try searching google for some answers.
This is one of many that i found on about five minutes of browsing. http://java.sun.com/docs/books/tutor...classdecl.html
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! Last edited by Pizentios; Mar 9th, 2005 at 11:16 AM. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|