7,116 Posted Topics

Member Avatar for beginner21

getActionCommand returns a String - the name of the command. You try to assign that to actionevent - a parameter whose type is ActionEvent, and you can't assign a String to an ActionEvent. You probably want to define a new String here, as in String actionEventName = actionevent.getActionCommand(); then use …

Member Avatar for beginner21
0
210
Member Avatar for rameezh88

That's because nowhere in that code do you define args. Do you have a main method with args as its parameter? That version of artgs is only available inside main. You'll need to copy them to somewhere else to use them in other methods.

Member Avatar for rameezh88
0
116
Member Avatar for JonGR

What errors exactly - if there's a message please quote it in full - if its a wrong result tell us what the actual and expected results are.

Member Avatar for Xufyan
0
193
Member Avatar for pennylynne

Just take it one step at a time Pick a button. What does it do? Which method in Calculator does that correspond to? Now code a call to that method inside an if test in actionPerformed for that particular button. Pick another button (etc etc)

Member Avatar for JamesCherrill
0
522
Member Avatar for Kerrai

You define: Scanner input = new Scanner(System.in); You use this to read input from the user: guess = input.nextInt(); But then for the next input you have: answer = scan.next(); It looks like you have forgotten that the scanner is called "input" and have mistakenly typed (or copied?) the name …

Member Avatar for musikluver4
0
226
Member Avatar for jknapp06

A proper answer could take one or more complete books, so this is just a snippet: [QUOTE]in a C style and used classes to make a new data type [/QUOTE] In java you use classes to provide services - data is usually hidden inside the class, and the public interface …

Member Avatar for JamesCherrill
0
139
Member Avatar for krbenet

It's easy. Just highlight all your code (click once before the fist line, hold down the shift key while clicking once after the last line) and click where it says CODE in square brackets at the top of the message box. Try it!

Member Avatar for NormR1
0
985
Member Avatar for keanoppy
Member Avatar for enfamos

Do you mean cannot find symbol, method [I][B]next[/B][/I]Char()? If so, check out the API for Scanner - there is no nextChar() method in Scanner (there also isn't a Char() method either) A char is a single character, and I guess your department names are longer than 1 char, so you …

Member Avatar for enfamos
0
124
Member Avatar for MeandJava

Re-read kvass's post. It contains exactly the info you need, and gives you exactly the instructions you need.

Member Avatar for JamesCherrill
0
442
Member Avatar for NewOrder

Are you referring to the fact that Console input does not work in Eclipse (or other industrial-grade IDE's)? If so, you can use a reader on System.in like this: [CODE] try { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Type name: "); String name = reader.readLine(); System.out.println("Hello " + name); } …

Member Avatar for ~s.o.s~
0
81
Member Avatar for juice33

You try to define isBoolean [B][I]inside [/I][/B]the main(...) method - probably because you are missing a } to close the definition of main. However, unless you correct the indentation, it's hard to see clearly.

Member Avatar for JamesCherrill
0
121
Member Avatar for NewOrder

19. Because the user of this class doesn't need to know about it, and if they did get access to it they would probably screw up the list. 28. When the return statement is executed 32. This stops execution of the method immediately and returns to the wherever the method …

Member Avatar for JamesCherrill
0
123
Member Avatar for shivaniaroraji

siand s2 are not objects, they are [B][I]reference variables[/I][/B] - like a pointer - that can hold references to a StringTokenizer object. StringTokenizer st1,st2; declares two reference variables, both [I]null [/I]at this stage. new StringTokenizer(quote1) creates an Object of class StringTokenizer - this is where the meory for that object …

Member Avatar for JamesCherrill
0
151
Member Avatar for Xufyan

No, one is push(int) the other is push (float), unlike your pops which are both pop(). Check Serena5's post again, it's the answer you needed.

Member Avatar for Xufyan
0
114
Member Avatar for jems5

Seems odd. Have you tried printing the array values after the update to confirm that they really are what you expect?

Member Avatar for jems5
0
135
Member Avatar for plasticfood
Member Avatar for mallak alrooh

Stuff in red seems unnecessary. In the print you can use the number to get the corresponding name and print that out as well. ps: Make sure your code is properly indented, and use CODE tags when posting.

Member Avatar for JamesCherrill
0
261
Member Avatar for dreamsky999

Looks like the final display screen is deeply buried in the nested if tests when maybe it needs to be after all those - without proper indentation it's hard to tell

Member Avatar for JamesCherrill
0
249
Member Avatar for TahoeSands

Normal method is to use a javax.swing.Timer (not java,util.Timer, which is different) to call back after "a few minutes". In the callback you change the shape etc then call repaint() to trigger Swing to call your paint(...) method. ps: It's advised to override paintComponent, rather than paint - you can …

Member Avatar for TahoeSands
0
171
Member Avatar for NewOrder

[QUOTE]the line 23 @Override should be deleted.[/QUOTE] Why? It's perfectly valid and very useful. [QUOTE]In the class InnerEx7 foo2 (the instance of the class Inner) is created as an instance of Foo's subclass. If the class Inner does not inherit Foo, in the class InnerEx7 there is no way to …

Member Avatar for NewOrder
0
114
Member Avatar for kandyhyatt
Re: help

You say you are doing something wrong - but what symptoms do you have - a compile error, and exception being thrown, program produces the wrong results etc? Without an exact description of the problem you are unlikely to find the right solution. But in the meantime, where is the …

Member Avatar for Ezzaral
0
107
Member Avatar for fariya

I think these packages are part of JavaEE, so if you have Java SE you need to upgrade. And if you are really still on 1.4.1 you [B][I]desperately [/I][/B]need to update!

Member Avatar for peter_budo
0
108
Member Avatar for dangari

JavaMail allows you to receive and process mail from a POP or IMAP source. [url]http://java.sun.com/developer/onlineTraining/JavaMail/contents.html[/url]

Member Avatar for dangari
0
151
Member Avatar for jems5

You have to use an if test in some form or another. If you really want to use catch/finally to handle it you can throw a new Exception, as in [CODE]if (somethingIsWrong) throw new Exception("Something went wrong");[/CODE] (although some writers think you shouldn't use exceptions for ordinary user errors)

Member Avatar for jems5
0
106
Member Avatar for tonyfingures

Some suggestions: line 17 - use Integer not Double - no fractions of shirts here! lines 39/40, 44 - these calculations overwrite the values you calculated earlier. If the answer was Yes you need to add some extra discount, and take something off the already-calculated total.

Member Avatar for JamesCherrill
0
163
Member Avatar for nickoooname

line 1: ArrayList planes_array[] = null; line 10: planes_array[i]=null; // since planes_array is null, planes_array[i] is null You need to initialise planes_array on line 1

Member Avatar for JamesCherrill
0
141
Member Avatar for Dean_Grobler

Is line 2 part of a method? (it should be) the dreaded serialVersionUID is because the API says any Serializable class should declare a version number so that if serialization changes you will know which version was serialised when you try to de-serialise it. Eclipse is just picking up every …

Member Avatar for Dean_Grobler
0
200
Member Avatar for shinnie

Maybe change the Counter methods to return the count rather than just a boolean. Then in your main loop you can just add up those counts. VowelsCounter seems unneccessary, since vowels don't score anything. You code will be easier to read & debug if you indent it properly. Mostcode editors …

Member Avatar for JamesCherrill
0
222
Member Avatar for GooeyG

You create an account a and deposit $1000, and print the balance of $1000. You then create another account c with the default balance of $0, withdraw $500, and print a balance of -$500. What's the problem? It's working perfectly.

Member Avatar for JamesCherrill
0
12K
Member Avatar for terzenta

You inherit the variable "balance" from the Account class, so it's not a good idea to declare a new one in CheckingAccount. Just use the inherited one, as in [CODE] public void setBalance(float Balance) { this.Balance = Balance - transactionFee; }[/CODE] Normally one would expect deposits to be done via …

Member Avatar for terzenta
0
119
Member Avatar for santoshkosgi

If you are just starting to learn Java don't start with something too hard. Spend a day doing the simplest game possible (eg scissors/paper/rock or Tic-tac-toe) first. You'll have to learn to code the same basic elements (input/some logic/output) that any game needs, and I promise it will save more …

Member Avatar for coil
-1
214
Member Avatar for riahc3
Member Avatar for tyson.crouch

This is possible, but Java is designed to be platform independent, and what you are describing is totally platform-dependent. I'm sorry to say this, but that's a job I would never recommend java for. Why not use one of the various tried and proven installers that are out there - …

Member Avatar for Ezzaral
0
118
Member Avatar for comSysStudent

students is an ArrayList of Student objects, so of course you can't cast them to Strings. the toArray method returns an array of Students in this case. Why are you converting an ArrayList to an array anyway?

Member Avatar for NormR1
0
325
Member Avatar for kumpul101
Member Avatar for sarkar.manab

Thread.getAllStackTraces() returns a map of stack traces for all live threads. You could ignore the stack traces and just look at the keys in that map for a list of all live threads.

Member Avatar for sarkar.manab
0
102
Member Avatar for samuel17

Line 22 is missing something ;). Just compare it with the other 3 showInputDialog lines and I'm sure you will see it.

Member Avatar for tong1
0
240
Member Avatar for eman 22

Java and Swing if you want platform independence, C# and .NET if you want Windows only

Member Avatar for JamesCherrill
0
55
Member Avatar for java_programmer
Member Avatar for joss23

I think your tests for invalid input should be || not && - ie it's invalid if either criterion is not met. And maybe you should put these tests before the accept/reject tests, so that a gp of 9 and a ts of 200 is shown as invalid rather than …

Member Avatar for joss23
0
119
Member Avatar for Olliepop

Three questions: How many lines are typically read from yahoo each time? Why do you close the in stream [B]inside [/B]the loop that's trying to read it? Have you used task manager to see what CPU utilisation you are actually getting - what is it in %?

Member Avatar for Olliepop
0
203
Member Avatar for python_user

You can use anything clickable (JButton, JLabel etc) and respond to the click by opening the URL. Or, if you want clickable links embedded in the text, use a JEditorPane in which you can display HTML and handle hyperlinks via a HyperlinkListener. Have a look at [URL="http://www.coderanch.com/t/345547/GUI/java/Making-clickable-links-HTML-JLabel"]this[/URL] then head on …

Member Avatar for JamesCherrill
0
80
Member Avatar for kkjava

The normal convention is that a set... method sets a single value, so when you call it repeatedly in your loop you are overwriting the the value you just set. There is only one value to get..., which will be the last one you set. If a bean has an …

Member Avatar for kkjava
0
159
Member Avatar for drogba123
Member Avatar for jalpesh_007

I think you have misunderstood the purpose of this forum. We are here to help you do your homework, not to do it for you.

Member Avatar for JamesCherrill
-4
117
Member Avatar for SeanC

Is x an instance variable (ie not static)? If so, every instance of Class1 has its own value for x. You can do whatever you like with x in one instance of Class1, and this will have no effect on the value of x for any other new instance of …

Member Avatar for masijade
0
469
Member Avatar for Wootens

Hold on a minute here - tong1 - are you sure you are answering the original requirement here? Wootens: go back to the version in your post that starts "Cheers, it compiles now", that's almost perfect, its just that you increment count OUTSIDE the loop when, obviously, it should be …

Member Avatar for Wootens
0
175
Member Avatar for NewOrder

[QUOTE]For converting a link list to binary tree, I'll have to dig a bit[/QUOTE] It's just like tree to list, ie iterate thru the list and add each element to the tree. [QUOTE]is it useful to remember how to convert a binary to link list?[/QUOTE] You certainly do not have …

Member Avatar for NewOrder
0
119
Member Avatar for diyes05

I guess that's Binary Search Tree, not British Summer Time? Wikipedia has a good intro, Google will find you everything you need.

Member Avatar for JamesCherrill
0
97

The End.