4,084 Posted Topics
Re: 1. I mainly post in the Java section because I'm a Java developer and rarely use C 2. don't PM people at random to get your code fixed, just wait untill someone who can actually help you responds. | |
Re: nope ... very bad code, and wouldn't always work. it looks correct, but, when it looks like a duck, and it cuacks like a duck, it could (in cases like this) also be a swann. it's the 'if-expression' where you're going wrong. you're not supposed to check equality of two … | |
Re: String sum = ""; if ( sum.equals("")) sum += num; else sum += " + " + num; or sum += " - " + num; and within each if where you add or subtract depending on where you are in your code | |
Re: instead of [Code=Java] System.out.print(""); [/Code] use [Code=Java] System.out.println(""); [/Code] that will make your pointer go to a new line for each print if you want to go and use excell files in java, you may want to look into [URL="http://jexcelapi.sourceforge.net/"]JExcelapi[/URL] or [URL="http://poi.apache.org/"]poi[/URL], a library by apache to use ms office … | |
Re: The problem is you have: [Code=Java] GUI go = new GUI(); [/Code] in two different places. one of them final. what you want to do is replace these instantiations by: [Code=Java] go = new GUI(); [/Code] and declare the variable go outside of the main method as a static instance … | |
Re: maybe you could check [URL="http://lmgtfy.com/?q=java+%2B+bubblesort"]this[/URL] | |
Re: well ... toString returns a String method, that's ... basically why the method 's named to'String'. of course, if some 'funny dude' decided to write a toString method that returns a Double (which I doubt), it can be anything. I think this: if(listCollector[0][y] == checker[0]){ needs to be if(listCollector[x][y] == … | |
Re: considering you don't have a valid main method .. how did you get it to run in the first place? | |
Re: ehm ... JOptionPane, Scanner, a Swing GUI, command line parameters, properties files, xml files, ... this is a bit like asking "how many different beers are there in the world?" basically, a lot, and everybody can come up with and write new ways, so it's not really possible to sum … | |
Re: well ... no one is going to download and check all your code, post the relevant code here and we might be able to check what's missing. and no, posting your entire application is not necessary, just the relevant code/method | |
Re: but why the wile loops? they're not really used, since they will never add up more than 1. just read the code and rethink what it does. | |
Re: I see you quoting someone, but is that your explanation or someone elses? is there still a question, or do you provide an answer? please be a bit more clear on these parts. | |
Re: sigh ... how many times are you going to re-post this same code with the same errors in it, ignoring the help and answers you are provided with? just check the other thread(s) in which you ask help for this code, and you'll see you should have finished your work … ![]() | |
Re: [Code=Java] textArea.append("Total minutes are: " +totalMin+"\n"); // prints out data textArea.append("Average Earnings are: " +average+"\n"); textArea.append("Minimum wage is: " +wage+"\n" ); textArea.setText(""); [/Code] what did you expect this to do? you're setting the textArea with "", meaning basicly, no text. try this: [Code=Java] String a = new String("Total minutes are: … | |
Re: by this line alone: System.out.println("The incomes of families making less than 10% of the maximum are: " + '\n'); I assume you either didn't test your code, or this is not the code you ran. print the text "The incomes of families making less than 10%" before the for-loop and … | |
Re: [QUOTE=abhijeetdani;1692878][code] if(!hello.equals(hello))[/code] this will give you false [code] if(hello.equals(hello)) [/code] this will give you true [code] if(hello.equals(HELLO)) [/code] this will give you false [code] if(hello.equalsIgnoreCase(HELLO)) [/code] will give you true Hope this helped!!![/QUOTE] didn't help.. this thread was started (and hijacked) years ago, by people who didn't come back to … | |
Re: because you're missing a '}'? you sure are missing one at the end of the code you've posted. or maybe because you are using a non-existing daysBetween method. | |
Re: ehm ... maybe should, but: 1. you never enter values in your classlist variable 2. [Code=Java] public String classlist(){ return classlist(); } [/Code] will indeed give you errors. remove the brackets, after all, you're not trying to return the method, but the values (you should have) stored in the classlist. … | |
Re: ehm .. yeah, pretty normal. you instantiate your variable 'grade' to 0, never change the value yet you do test on this value. no matter how many times you run it, grade will always be 0 | |
![]() | Re: since in an enhanced for loop, you won't automatically have the x which you use as index for score and which, I assume, link the element in score to the element in grade, what do you want it for? |
Re: explaining why a factor behaves in a certain way is more a question to ask a mathematician. | |
Re: you're getting a nullpointerexception somewhere on line 20, but since there's no code on line 20... I assume there's a problem in your use of the Synthesizer class, but since I've never seen it, don't know which one. | |
Re: yes, that is possible ... might be easier to spot your mistakes if you post your code. | |
Re: mmm ... I don't really get what it is you're trying to do. if you want an action to perform on clicking a label, MouseClicked should be able to do that for you | |
Re: not to mention the fact that, in the last 24 hours alone, code snippets have been posted on this forum that could easily help you solve your problem. this is not a "code-delivery" that works 24/7, a bit effort on your part is expected. | |
Re: what are you doing this for? [Code=Java] (char)(((int)ch) [/Code] basicly, you have a char, which you transform into an integer primitive, just to transform it to a char again. not only is this completely useless, but it makes your code quite annoying to read, since just one misplaced or forgotten … ![]() | |
Re: looks like you're having a nullpointerexception in your MainGui class, on line 35. might want to check that out. something you're missing in the constructor of SquadPanel, perhaps? | |
Re: you may want to 1. check the Math class and see if there's anything in there that can help you 2. if it doesn't try to write a method yourself 3. if you can't figure out what the code should be: be a bit more clear about what you expect … ![]() | |
Re: [QUOTE=saba akmal;1691488]10[/QUOTE] yah?? ow key. | |
Re: a .class file is a compiled .java file if you want to run this, you'll have to open the command prompt and go <path> java classname if on the other hand you have a java file, which is an archive executable file, you can run it by just clicking on … | |
Re: can you give a bit more information before we start going through that code? what is the sound format you're trying to use? | |
Re: you should use a float or double for your 'i' value. you're dividing a value x by a value greater than x, which gives a result of 0.xxx, which can not be stored into a float variable | |
Re: setVisible(false); hide(); .. there are a few methods that come in handy that you can use ![]() | |
Re: you've mentioned everything you need to do. is it necessary you throw an exception, do you just have to show an error message, ... be a bit more clear, and show what you've tried so far. | |
![]() | Re: what exactly is the loop you're having trouble with, what is the input you're giving? is it giving an error message? |
Re: you're continuing to run the loop after you've found it, which means you'll come into your 'else' block again. and there you overwrite the value you have stored. I think, a better way would be to run your loop, when you've found your desired index, don't store it in a … | |
Re: you may want to start with the sticky thread on top of this forum. it's filled with tips for starters. | |
Re: best would be to create the arrays on class level, not within a method. that way, you don't have to pass them as parameters, and still use them within several methods. do you know up front how many elements the files have? if so, instantiate the arrays when you declare … | |
Re: well .. first remark: I think what you want is keeping information per instance of customer, so, I'd suggest you remove a lot of those static-keywords. static means you store the information or value for an entire class, so, if you create a second customer, you won't store a new … | |
Re: the setter can always return a value, if you write it like that, but a setter is ment to 'set' data, not to 'get' it. a better way would be to throw an exception, as JeffGrigg suggests. alternatively, you could check the value of a getter , but this would … | |
Re: I'm not entirely sure what you are talking about. what exactly are you stuck with, what have you done so far? as I understand it, you are having trouble to declare an array as a variable? | |
Re: he wants to input "hello" in an jTextBox and have a jLabel show "olleh" @OP: the functionality of that method has nothing to do with how it is used, it's the same for a command line app as for a GUI app. what have you done so far? | |
Re: the add and addAll methods could do the trick as well, depends on how you read your data. | |
Re: you can off course encrypt it, but it'll still need to be equal to the username and password of the database. you can keep the username and password in a properties file, or in an xml file, but the most secure way, I guess, is to have the user enter … | |
Re: you can re-define it, but not as long as it is in the same scope. | |
Re: em ... try help you with what? ok, you've stated what you want your application to do, but you haven't told us what it does do... does it give you an error message?, does it run, but give a different output than you expect? does it fail to compile? ... … | |
![]() | Re: either that, or, if you want more control, and you don't want for all entries to take both upper and lowercase (for instance: b, B and s are valid, but S is invalid) [Code=Java] case "b": performB(); break; case "B": performB(); break; case "s": performS(); break; [/Code] ![]() |
Re: maybe because Java programming is not your thing? and whaat exactly do you mean by: i know how to program, but I don't know how to be professional, I don't know how to practice programming? | |
Re: question 1: what do you mean by, find mode? question 2: you enter a value, and based on that value, you can use two nested for loops: the outer one, determines the height of your pyramid the inner one, you should use to print the lines as you want them. |
The End.