713 Posted Topics

Member Avatar for lancevo3

That code looks like it should compile okay - did you maybe have a command-line typo when you went to compile or run?

Member Avatar for lancevo3
0
144
Member Avatar for ROSS679

[CODE] while (frontteeth <=0); ... while (rearteeth <=0); [/CODE] The semicolon at the end of this line is an instruction. It means "do nothing". So if frontteeth or rearteeth is le 0, it'll hang at one or the other of these points. For input validation, I think a do...while loop …

Member Avatar for ROSS679
0
195
Member Avatar for xshinichix

For this assignment your constructors aren't actually constructing a class, they're demonstrating the order in which constructors are called, and how the code executes. So there isn't really a problem to solve: you're just going to write four dummy classes, each of which extends the previous one and has a …

Member Avatar for jon.kiparsky
0
191
Member Avatar for palamonin

It won't hurt to try to do a little work for yourself. Might even do you some good. Go on, give it a try.

Member Avatar for jon.kiparsky
0
55
Member Avatar for shakssage

[QUOTE]I'm now having a problem with trying to identify if there are any cars on a specific lane, if so, then do some stuff, such as stop behind or slow down etc. [/QUOTE] It sounds like what I'd be looking for would be for the Lane to tell me whether …

Member Avatar for shivam7
0
251
Member Avatar for Transcendent

Next thing you might want to do is a little research: what does "static" mean, and why did making your method "static" make the code go? How could you have solved this without declaring that method as static? Quick and easy answers are nice, but you might as well take …

Member Avatar for Transcendent
0
140
Member Avatar for speedy94519

I'm pretty sure it's not correct. What you're comparing here is identity. This returns true only in the case that the address contained in this.a is the same as the address contained in o.a. You're comparing pointers. So if you declare this.a to be a new Point(5,5), and you'd previously …

Member Avatar for jon.kiparsky
0
152
Member Avatar for sainzkr

Are you getting the return value from the final dialog? Use that to control a loop. [CODE]boolean again = true; while (again) { all of that; if (dialog returns YES_OPTION) { do one thing} else if (dialog returns NO_OPTION {do another thing} else { uh-oh, this shouldn't happen!) }[/CODE]

Member Avatar for jon.kiparsky
0
93
Member Avatar for mjv89

[CODE]for (i = 0, i < 3; i++); for (j = 0; j < 3; j++);[/CODE] These lines simply count to three, twice.

Member Avatar for jon.kiparsky
0
133
Member Avatar for mjv89

Your second loop is going to j<=l - since l is array.length, this takes you over the edge - you're trying to access array[0][2] Change the <= to < and you should be okay.

Member Avatar for mjv89
0
90
Member Avatar for kimhj91107

You've got the output section within the for loop. That means that each time through the loop, it gets two Strings and an int, calculates a char for the grade, and prints. If you end the for loop before the printf statements (move one of the right curly braces up …

Member Avatar for jon.kiparsky
0
96
Member Avatar for atticusMom

[CODE] public Password(String password) { // initialise instance variables password = userPassword; } [/CODE] You want these the other way around. This line should assign your parameter (password) to the instance field (userPassword) so the rest of the class can use it. Your isValid method looks troublesome to me. For …

Member Avatar for jon.kiparsky
0
141
Member Avatar for LianaN

Why are you passing in JOptionPane.CLOSED_OPTION? That should be a return value, shouldn't it? It's probably got the same value as the input option you're looking for (per the API, you want an option type: optionType - the options to display in the pane: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION) That won't …

Member Avatar for LianaN
0
225
Member Avatar for draven07

Is it just me, or does this smell like a homework assignment to anyone else? You can only use one layout in a panel at a time. You can use multiple panels, nested, with different layouts, but a single Panel gets a single LayoutManager, as far as I know. You …

Member Avatar for jon.kiparsky
0
89
Member Avatar for lashbandi

[QUOTE]The program must simply ask the user to type in a text[/QUOTE] Well, if that's all you need, it's easy enough: [CODE] public class TooLazyForWords { public static void main(String[] args) { System.out.println("Please type in a list of words separated by spaces"); } }[/CODE] There you go. Requirements met, as …

Member Avatar for jon.kiparsky
-2
132
Member Avatar for LegendX

To get it to line up like your image, you'll need to use the c-style printf() function. Since this is well documented by Sun, I'll just briefly review it. printf is based on the function of that name in the C language. It allows in-line interpolation of variables with some …

Member Avatar for jon.kiparsky
0
171
Member Avatar for lisaroy1

Not sure what you're asking. A typical gui might have a JFrame, which would have a main JPanel into which you'd put your components. You might use nested JPanels for organizing components (a button panel for your JButtons, for example). You might also find that you use JTabbedPanes or JScrollPanes …

Member Avatar for jon.kiparsky
-1
102
Member Avatar for SaberExcalibur

(This is based on my experience with Java - other languages may vary) A class is the template from which an object is created. A class defines object, an object instantiates the class. The main difference is how they go about existing on the stack. When a class is loaded, …

Member Avatar for SaberExcalibur
0
133
Member Avatar for AndreRet

Some more thoughts: -Second the (CODE) button in the quick reply window. -The (THREAD) button, in my dream world, would show a list of recently-visited threads to choose from, or accept a pasted URL. I'm not sure what the corresponding ideal behavior for (POST) would be, but probably selecting a …

Member Avatar for WASDted
0
273
Member Avatar for curbster

If the purpose of the assignment is to learn to use the library methods, then using the library methods is the right way to go. If the purpose of the assignment is to learn what lies behind the library methods, then you have to do something more like the K&R-type …

Member Avatar for curbster
0
1K
Member Avatar for amr321

First of all, stop with the smileys, they're aggravating. So you're having trouble with data structures - is that because you're having trouble getting the concepts, or because the coding is difficult, or both? If you understand what a linked list is, but you have trouble writing one, you have …

Member Avatar for rusl07cl08
-1
648
Member Avatar for happygeek

As long as we're wishing, can we get rid of the Salvation Army bellringers?

Member Avatar for mrnutty
3
175
Member Avatar for ajst

The simplest thing would be to open up a new JFrame to display screens of help. How you organize the information will depend on how much there is, but let's suppose that you need to explain the rules, the controls, and the interface with the machine (saving a game, settings, …

Member Avatar for jon.kiparsky
0
129
Member Avatar for Translucentbill
Member Avatar for purijatin

Curiouser and curiouser. When I set it up, I put a timer around the first loop. For any simple numeric value in the test condition of the first loop, it optimized out to zero millis and about 1 second for the second loop. However, when I set the test condition …

Member Avatar for purijatin
0
189
Member Avatar for katara

a) please don't bump old threads to ask new questions b) if you have a question, please ask it clearly. If you want help with something you're writing, please let us know what particularly you need help with - otherwise, someone's likely to think you're looking for someone to do …

Member Avatar for JDCyrus
0
115
Member Avatar for Anirudh.

[QUOTE]Write a program to calculate the number of words,tokens,keywords,userdefined functions,system function for your java program.[/QUOTE] Okay, did that. What should I do next?

Member Avatar for jon.kiparsky
0
104
Member Avatar for mangopearapples

That's not going to be a simple one. The contents of a text area are stored as a single line, with wrapping provided by the component, so there isn't a method that'll just return an arbitrary line. I would probably set the font to a monospace and see if you …

Member Avatar for mangopearapples
0
2K
Member Avatar for ColMatrix

Have you tried looking to see what is in $VarComparison after this assignment? [CODE] my $VarComparison = $Sheet->Cells($row,$VarICN_Col)->{'Value'};[/CODE] Just a thought.

Member Avatar for erezschatz
1
285
Member Avatar for salmanrauf

In case there is any confusion, I want to stress that the resemblance between try/catch/finally and if/then/else is purely superficial, and the two should not be confused. As Sean noted, the finally clause always executes (barring some extremely complex and extremely unlikely constructions that code lawyers have come up with), …

Member Avatar for JamesCherrill
0
137
Member Avatar for Statoeo

I seem to recall that Eclipse won't automatically include non-java files in a build. If I'm remembering correctly, you'll have to write an ant build file to get this to go. However, I'm not a real heavy-duty Eclipse user, so it's possible I'm wrong on this.

Member Avatar for Statoeo
0
279
Member Avatar for pablouin
Member Avatar for Rona25

The simplest thing would be [CODE]System.out.println(123); System.out.println(12); System.out.println(1); System.out.print("\n\n"); System.out.println("help me..");[/CODE] Meets your stated requirements, anyway. Anything else we can help you with?

Member Avatar for VichuTheWizard
-1
122
Member Avatar for rayden150

To test whether you understand the code after reading James' explanation, there's a very simple change you can make to this which will eliminate about half of the work this program has to do. The change is very simple, it involves one arithmetic operation inserted in the right place. Can …

Member Avatar for jon.kiparsky
0
317
Member Avatar for Toni Chopper
Member Avatar for DarkLightning7

[QUOTE]note: Line numbers are matched correctly [/QUOTE] I don't believe they are. Line 32 in this numbering doesn't call PickWord(). I don't know exactly which call you're looking at here, and I don't know which line triggered the NoSuchElementException, but that exception is thrown by a Scanner when you try …

Member Avatar for DarkLightning7
0
275
Member Avatar for eikal

First of all, if you're using "println", it'll put a carriage return at the end of the line. System.out.print() will just output the string, without the carriage return. That'll help you format your output the way you want. There's also printf(), but that's a little complicated, and you don't really …

Member Avatar for privinpt
0
116
Member Avatar for bangor_boy

What do you mean by "it won't work"? What is it doing or not doing, and what do you expect instead? Is it compiling? Does it run? What happens when it runs, assuming it does? If it compiles, then that would mean that ButtonWatcher is implementing ActionListener correctly. That only …

Member Avatar for jon.kiparsky
0
172
Member Avatar for shack99

The reason for that error is not hard to determine: the operator < can only be applied to numeric types. String is a class, a String is an object, they can't be compared in this way. You want the compareTo() method. Read up on Comparable if you're not familiar with …

Member Avatar for jon.kiparsky
0
13K
Member Avatar for mbouster

James - unfortunately, for Mac users who still use 10.5.8 (which is a large number) there are a lot of issues with 1.6, especially around applets. I've seen this now on two completely unrelated projects: if you're writing applets, you have to expect that Mac users will be unable to …

Member Avatar for jon.kiparsky
0
230
Member Avatar for JavaStudentCode

Sorry for the pseudocode, but I'm not going to write your homework for you. You need to read the file and split each line into its component parts. The parts are delimited by spaces. Assuming that this is a consistent format, we can do this: [CODE]declare five arrays; // 1 …

Member Avatar for Katana24
0
897
Member Avatar for ~s.o.s~
Member Avatar for unknown12

[QUOTE=unknown12;1432055]i fixed this up so it works however when i enter in a negative # It Doesnt tell the user it wont work. any sugestions?[/QUOTE] Sounds like you want an if statement. If input is less than zero, print some sort of warning, otherwise go ahead and execute the program …

Member Avatar for pbl
0
138
Member Avatar for adams161

[QUOTE]clearly there is a need. i just outlined the need.[/QUOTE] Means and ends. You don't need a preprocessor, you need a technique for getting your program to exhibit the behavior you want. The preprocessor is the means you'd use in C++, that's all. In java you'd do this a bit …

Member Avatar for adams161
0
230
Member Avatar for ibdatx

If you want commas within your fields, you'll probably want to use a different delimiter. Excel is pretty flexible on this, if that's what you're importing to. Semi-colon, space, tab are standard enough to get radio button on their import tool, but you can specify whatever you like. Pick something …

Member Avatar for fredfletcher
0
818
Member Avatar for javap

Gentlemen, or ladies, as appropriate, let's please try to be a little subtle here. Here's a New Year's resolution for you: in the coming year, I will help people find a solution, not give them their solution. Now, javap - what have you tried so far, and what has been …

Member Avatar for JKP()
0
147
Member Avatar for mangopearapples

Simple geometry, really. Suppose the images are quadrilaterals. If any point of image1 is between the top and bottom of image2, and also between left and right of image2, then you have a collision. If image2 is a circle, it's still simple - if the pythagorean distance from any point …

Member Avatar for mangopearapples
0
141
Member Avatar for john sigma

Let's start by making your life a little easier. There's no reason to have the same method 26 times. Can you see any way to make your `getButtonA()` method generic, so you can use the same method for all of the characters? I'll give you a hint: there are only …

Member Avatar for jon.kiparsky
0
203
Member Avatar for kangkan_14

It would probably be a mistake to think of "public"and "private" as relating in some way to the distinction between global and local scope. The notion suggests a bit of confusion about object-oriented programming. Public and private fields of a class are all "global" in that they can be called …

Member Avatar for kangkan_14
0
278
Member Avatar for jaycastr

vi and javac is my environment of choice, but I use Eclipse at the day job because they require me to work on their Windows machine. Eclipse is not terribly painful, but I find its attempts to help me quite irritating. I'll write my own code, thanks very much, I …

Member Avatar for Akill10
1
460

The End.