Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Miscellaneous > Archive > Off-Topic-Archive > Java quickie
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!

bottom of page
  
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
reds4ever is offline reds4ever
Prince
of the Spion Kop
Mar 2001
time: 05:27
  Old Post 02-04-2003 02:36
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
Java quickie Remove this text

can someone tell me why passing this boolean argument:

ballThread[i] = new Thread(new BallThread (ballArray [i], even)

to this:

public BallThread (Ball b, boolean e)

causes an error? it compiles fine without the boolean, all the variables are declared etc

even is just a boolean value based on whether an object in a thread is odd or even

cheers

raghar is offline raghar
Chieftain
I wish somewhere else.
Oct 2002
time: 05:27
  Old Post 02-04-2003 04:05
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Got spare money?

Are you sure that boolean even=true; ?

Skanky Burns is offline Skanky Burns
Deity
Skanky Bastard Quartermaster
Aug 2001
time: 14:27
  Old Post 02-04-2003 04:07
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Full PM-box? Change here!

What exactly is the error when you try to compile it?

reds4ever is offline reds4ever
Prince
of the Spion Kop
Mar 2001
time: 05:27
  Old Post 02-04-2003 05:07
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Full PM-box? Change here!

thanks for responding, i'm still finding my feet with this, in answer to your questions

even = ((i %2) ==0);

that gives true or false?

the error is: 'constructor BallThread (Ball, boolean) not found in class .......'

as soon as i stop passing the boolean argument the program complies ok

thanks

Skanky Burns is offline Skanky Burns
Deity
Skanky Bastard Quartermaster
Aug 2001
time: 14:27
  Old Post 02-04-2003 05:16
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Increase Your PM Length

Thought so.

You need a constructor BallThread (Ball, boolean) in the BallThread class that instanciates a BallThread object.

In other words, find the BallThread (Ball) object, copy the whole "function" and paste it below, then add a boolean functionality.

To explain what I mean, this is a quick demonstration.

code:
BallThread( Ball b ) { //This is your original function this.ball = b; } BallThread( Ball b, boolean e ) { //This is the new one you create this.ball = b; this.even = e; }

Hope this helps.

reds4ever is offline reds4ever
Prince
of the Spion Kop
Mar 2001
time: 05:27
  Old Post 02-04-2003 05:45
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Avatar Enlargement: We've got the solution

many thanks Skanky, thats exacty what i needed! i was on the crest of a wave being able to tell if a number was odd or even!

even = ((i %2) ==0); // in one line as well!!!

line, then that error came up.

i still don't understand why i need the line 'even=e' before i use it, 'e' is passed to the constructor why can't i use it 'as-is'

thanks

Skanky Burns is offline Skanky Burns
Deity
Skanky Bastard Quartermaster
Aug 2001
time: 14:27
  Old Post 02-04-2003 06:22
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Tired of ads?

That was just for demonstration purposes. In my example, the object stores that value for later use. For your program, you may use it when you initiate the object or store it too - what you need to do with it depends very much on what your program is doing and, well, what you need that value for.

Basically, if you don't need to store the value, then you don't need that line.

reds4ever is offline reds4ever
Prince
of the Spion Kop
Mar 2001
time: 05:27
  Old Post 02-04-2003 06:34
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

gotcha! thats what i couldn't understand

thanks again

raghar is offline raghar
Chieftain
I wish somewhere else.
Oct 2002
time: 05:27
  Old Post 02-04-2003 06:45
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Support Apolyton buy from Amazon

quote:
Originally posted by reds4ever
new BallThread (ballArray [i], ((i %2) ==0))


And I don't understand how can someone write one custom constructor and forget to write second.

Please tell me that you are just few week old student of Java, or you are heavilly overworked person.

reds4ever is offline reds4ever
Prince
of the Spion Kop
Mar 2001
time: 05:27
  Old Post 02-04-2003 06:54
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Support Apolyton, buy Call to Power 2

quote:
Originally posted by raghar


And I don't understand how can someone write one custom constructor and forget to write second.

Please tell me that you are just few week old student of Java, or you are heavilly overworked person.


got my first 'idiots guide' book the end of Febuary, weve all got to start sometime!!

i'll get there in the end, in the meantime, be on standby.....!!

raghar is offline raghar
Chieftain
I wish somewhere else.
Oct 2002
time: 05:27
  Old Post 02-04-2003 07:09
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Increase Your PM Length

Well, it took me 6 months to find difference between public main (String ) and public main (string). I looked at Delphi at that time period and didn't have time to look at it properly. BTW it was windoze fault. It closed console window so quickly so I have no chance to see error message.

Skanky Burns is offline Skanky Burns
Deity
Skanky Bastard Quartermaster
Aug 2001
time: 14:27
  Old Post 02-04-2003 07:11
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

I open a dos window for compiling, just so I can see the errors (if they ever occur)

reds4ever is offline reds4ever
Prince
of the Spion Kop
Mar 2001
time: 05:27
  Old Post 02-04-2003 07:22
Edit/Delete Message Reply w/Quote
#13 Report this post to a moderator
Support Apolyton, buy Civilization 2

i'm getting a lot of 'Doh!' moments, if you know what i mean?

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:27.
Apolyton Time is 00:27.
    top of page
Rate This Thread:
archivepost
Forum Jump:
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0418 seconds (88.17% PHP - 11.83% MySQL) with 31 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net