7,116 Posted Topics

Member Avatar for mcddewitt

What you are asking for can't be done like that, but arrays were invented to solve that problem. You can't dynamically create e1, e2, e3, but you can create an array e[] and dynamically assign e[0], e[1], e[2] etc. ps To test two Strings for containing the same sequence of …

Member Avatar for NormR1
0
97
Member Avatar for Ssnowlin

Maybe your Hotel should have a number of Rooms (stored in an array Room[]). The checkin/out is something that happens in the Hotel class, but is associated with one of the Rooms? Just a thought...

Member Avatar for NormR1
0
172
Member Avatar for fattyJ

Lines 45-55 you have a while loop that loops as long as there are any tokens to be parsed, and stores them in fName, each overwriting the previous value. Then it drops out of that loop and never executes any of the following while loops because you have already "processed" …

Member Avatar for NormR1
0
932
Member Avatar for nickliutw

You can't "return the println" - that makes no sense. println is a method, not an object. Your usual options would be either to return null or to throw an exception if the find fails to find anything. ps: Remember that you can return from anywhere in a method, including …

Member Avatar for NormR1
0
598
Member Avatar for pro_learner

Sleeping in a Swing GUI usually stops everything from working by blocking the Event Dispatch Thread ("Swing thread") on which Swing handles everything. Its never a good idea. Use a javax.swing.Timer to implement delays and repeated processes.

Member Avatar for pro_learner
0
265
Member Avatar for harsimran05

Hi Majestics. Watch out, this is a duplicate post. In the other copy I was trying to get the OP to fix his indentation to find the missing }, but he seemed to want me to do it for him.

Member Avatar for peter_budo
0
161
Member Avatar for harsimran05
Member Avatar for sirlink99
Member Avatar for sirlink99
0
241
Member Avatar for Onlineshade

Assuming you are using Windows, the info you need is here: [url]http://download.oracle.com/javase/tutorial/getStarted/cupojava/win32.html[/url] Linux is here: [url]http://download.oracle.com/javase/tutorial/getStarted/cupojava/unix.html[/url] In addition you will need to download javax.mail from the Oracle Java website. [url]http://www.oracle.com/technetwork/java/javamail/index.html[/url]

Member Avatar for JamesCherrill
0
192
Member Avatar for she05

Yes, it's completely possible. Just like passing anything else. Beware: you declare the list on line 12, then on line 66 you declare another one with exactly the same name. Probably a mistake.

Member Avatar for JamesCherrill
0
132
Member Avatar for chiiqui

The code inside those if (cases== locks looks very repetitive. Perhaps you can put that into a single method with parameters for those things that are different each time, then just call the method from your if tests.

Member Avatar for JamesCherrill
0
166
Member Avatar for authi

@miltondollar. Please do not violate forum rules. Do not hijack old dead threads. Start you own new thread.

Member Avatar for JamesCherrill
0
4K
Member Avatar for jackiewcc

WARNING: THIS IS VERY SIMPLIFIED: Methodologies split into two main camps - waterfall vs RAD. Waterfall methods are based on sequential processes - get requirements, then design solution, then code, then test etc. RAD methods are based on building something very quickly then improving it through many iterations. In my …

Member Avatar for JamesCherrill
-1
130
Member Avatar for stevanity

You're not exactly giving us a lot of info on what it is that's not working "properly". If you want help, please start by posting a detailed and precise description of exactly how the actual behaviour differs from the expected behaviour.

Member Avatar for stevanity
0
110
Member Avatar for lynnb86

You are using a package spec employeeinfo.EmployeeInfo, so the compiler expects to find EmployeeInfo.java in a directory employeeinfo - ie your directory structure must exactly match the package structure.

Member Avatar for lynnb86
0
304
Member Avatar for Majestics

Direct access to Outlook from Java is a real pain. It's a COM interface, but com4j seems to have big bugs with Outlook and Jacob is really hard to use (those are the two realistic Java/COM bridges). However, some scripting languages have direct access to COM interfaces, and with the …

Member Avatar for Onlineshade
0
180
Member Avatar for jjohnson33

I guess you didn't notice that the post was from August 2004? I very much doubt that the OP is still waiting for an answer.

Member Avatar for JamesCherrill
0
645
Member Avatar for Ephron

Unless you have truely gigantic strings arriving a high rate per second then performance is unlikely to be an issue. Much better to find a clear and obvious way to code it, and only worry about performance if it becomes a problem. Just convert to a char array, then take …

Member Avatar for Ephron
0
217
Member Avatar for Bladtman242

In real life card games, cards are drawn from one or more shuffled packs, so a more realistic code design would be to create a new "pack(s) of cards" which was a collection (eg ArrayList) of n*52 Cards (n of each), then the draw method just takes a random card …

Member Avatar for Bladtman242
0
194
Member Avatar for binoman

Floating point numbers are represented in binary fractions. (1/2 + 1/4 + 1/8 + 1/16 etc). You fractional value is 0.3, ie 3/10. There is no exact way to represent 3/10 using only binary fractions, so the answer has to be slightly wrong. This is true of all floating point …

Member Avatar for binoman
0
1K
Member Avatar for karyal

Using a null layout manager is usually a mistake - layout managers are there for good reasons (different system font sizes on different machines, different screen resolutions, user-resizable windows...). This trick is to chose the simplest layout manager that does what you need. That usually means BorderLayout, FlowLayout, BoxLayout, or …

Member Avatar for karyal
0
111
Member Avatar for vishal1949

The question requires underflow, not overflow. Underflow is when you try to pop but there is nothing in the stack, eg if you go [CODE]new stack stack.push(something) stack.pop() // OK stack.pop() // stack was empty -> underflow[/CODE]

Member Avatar for JeffGrigg
0
450
Member Avatar for baby_c

Using a null layout manager is usually a mistake - layout managers are there for good reasons (different system font sizes on different machines, different screen resolutions, user-resizable windows...). This trick is to chose the simplest layout manager that does what you need. That usually means BorderLayout, FlowLayout, BoxLayout, or …

Member Avatar for baby_c
0
190
Member Avatar for warlord902

I haven't tried this myself but... Java 6 has the new Desktop API that allows you to open the user's default web browser with a URI of your choice [url]http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/desktop_api/[/url] presumably if this is a page that you have written (maybe embedding a remote page in a frame) then you …

Member Avatar for warlord902
0
421
Member Avatar for janice91

You have a lot of detailed instructions there already. Just start following them, and come back here when you get stuck. ps Indent your code properly, it will help you as well as us.

Member Avatar for JamesCherrill
0
201
Member Avatar for aldeene
Member Avatar for JamesCherrill
0
128
Member Avatar for newbie14

Hi guys. I'm jumping in here because I was involved in the original architecture of this app and want to share a bit more background. Transactions arrive unpredictably from multiple clients at a server. The server simply captures the transaction and adds it to a LinkedBlockingQueue. A separate database thread …

Member Avatar for JamesCherrill
0
154
Member Avatar for Anuradha Mandal

If you are a complete beginner with Java then going straight to netbeans (or eclipse etc) is not a good idea. (1) A full IDE has its own steep learning curve to add on top of the Java learning curve, (2) A full IDE's tools will fix problems for you …

Member Avatar for icyfiren
0
99
Member Avatar for thompsonSensibl

Long/lat map points on a sphere. x,y map points on plane. You can't meaningfully convert between the two except over areas small enough that you can ignore the curvature of the earth.

Member Avatar for NormR1
0
306
Member Avatar for yinp

Hi yinp. Although there is nothing necessarily wrong with cross-posting, if you do so it is normal protocol to mention that fact at each site where you have duplicated your post. You will find that many people chose not to waste their time trying to answer a question that may …

Member Avatar for JamesCherrill
0
209
Member Avatar for Samar Sharma

Just google java printing and you will find many tutorials on how to do it,

Member Avatar for RvSon
0
87
Member Avatar for optikali

Original post: Depending on exactly how you want that distribution to go, you may be able to use a fudge like taking a random int 0-5625 then taking its square root. That will give you a smooth parabolic distribution biased towards the bottom of the range (50% of the numbers …

Member Avatar for JamesCherrill
0
1K
Member Avatar for coco24

@edensigauke: the OP's requirement is to get the value from the runtime parameter(s) args[], so your suggestion about System.in is more likely to confuse than help. @coco24: although @edensigauke's code is not what you need, there is one line that you should have a look at - it's concerned with …

Member Avatar for Rameshwar Soni
0
149
Member Avatar for thompsonSensibl

Have you created a City class yet (attributes name, number, noOfPets)? That's the first stage. Then you can create an array of City's. When you sort that array each City keeps is own name, number etc; there's no risk of them becoming "not associated".

Member Avatar for JamesCherrill
0
158
Member Avatar for D3X

Looking at your posts I see [CODE]if (transferaccount_id==transferaccount_id){ [/CODE] and [CODE]if (intransferaccount_id.equals(intransferaccount_id)){[/CODE] but in both cases you are comparing the [I]same object[/I] to itself! I would expect to see something more like [CODE]if (accountBeingTransferredFrom.equals(accountBeingTransferredInto)) { // can't transfer to same account[/CODE] (but with your own variable names, obviously)

Member Avatar for JamesCherrill
0
111
Member Avatar for jinglylime

Not a bad start. You may be missing one class because your Trade class represents both individual Trades (buy/sell), but also has the list of Users and Shares. Users and Shares belong to a StockMarket. In the StockMarket you can register and delete Users and Shares, and create many Trades. …

Member Avatar for JamesCherrill
0
117
Member Avatar for thompsonSensibl

Use the string method charAt(int index) in a loop to get the chars one at a time. The Char class then has methods to tell you if a char is a letter or a number or whatever.

Member Avatar for NormR1
0
258
Member Avatar for newbie14

If you want to know which date is earlier then yes, you need to convert both to Date. You can use the SimpleDateFormat class to convert/parse a string into a Date

Member Avatar for newbie14
0
166
Member Avatar for thompsonSensibl

OP has started a duplicate thread for this. [url]http://www.daniweb.com/software-development/java/threads/379499[/url]

Member Avatar for JamesCherrill
0
174
Member Avatar for muaazab

Unless you are doing something very special and complex you will never need to use System.gc(); Java will do its garbage collection when appropriate, there's no reason for you to get involved. finalize() is not what it seems. It's run when the object is GC'd, which may be any time …

Member Avatar for JamesCherrill
0
253
Member Avatar for vishal1949

Have a look at the SimpleDateFormat class. You will find it has methods to convert (parse) Strings in various formats into Dates that you can add to your list.

Member Avatar for JamesCherrill
0
109
Member Avatar for Genericusername

Note also that if you declare a class as being in package xxx then Java expects to find that class's files in a directory called xxx. So if you add a package spec to a class, you also need to add the corresponding sub-directory and move your files into it.

Member Avatar for Genericusername
0
146
Member Avatar for sathya88

Line 196 It's the same mistake that has already been pointed out to you twice.

Member Avatar for sathya88
0
207
Member Avatar for DarkPheonix

I haven't studied the code in detail, but I'm not surprised that the execution terminates differently with or without the System.exit. With it the code terminates as soon as the exit square is found. Without it the current invocation returns to the the call on line 42, and the loop …

Member Avatar for DarkPheonix
0
177
Member Avatar for thompsonSensibl

If you look at the correct solution you will notice that each pair consists of an element and a second element that comes later in the array, ie [CODE]for each element i in codesArray for each element j that appears after i in codesArray pairThese(i,j)[/CODE]

Member Avatar for thompsonSensibl
0
133
Member Avatar for sealxlion

Class Main lines 10, 17 [B][I]you [/I][/B]make them both visible. Don't make mainframe window visible until after logon.

Member Avatar for mKorbel
0
169
Member Avatar for dhea_andiesss
Member Avatar for Anuradha Mandal
0
150
Member Avatar for nikolaos

You could easily separate the SQL part (around lines 52-68) into a method with the signature [I]public ResultSet getDataFor(String user, String password[/I]) and that method could be in a different class. That would make the code easier to understand and maintain. But ideally though it would be better to separate …

Member Avatar for nikolaos
0
2K
Member Avatar for betny

Arrays are 0 based,, so a [5] array has length 5 and indexes 0-4 Your loop for(int i=0; i<=personArray.length; i++){ will attempt to access indexes 0-5, and will fail on the last one with an IndexOutOfBounds (5)

Member Avatar for JamesCherrill
0
167
Member Avatar for syeda amna

Its the full width of the window; just how broad did you want it to be?

Member Avatar for JamesCherrill
0
138

The End.