4,084 Posted Topics
Re: You might want to go to .jsp or .jsf files, instead of plain html | |
Re: ChaiNeeys: this is a three year old (Dead) Thread. let it rest. If you have questions of your own, post them in a new thread. If you want to see the output of the above code, run it. | |
Re: A "SORTED" List is already sorted, that's why it's called a 'sorted' list. | |
Re: So, basically, your thread is about telling us you have a snippet of code? There's no question? | |
Re: So ... what do you think it is? You do realize it would only take you half the time it took to post it here, to actually test what the outcome would be, right? | |
Re: again: this entire block else if(playerage >= 8 && playerage <= 13) { System.out.println(playername+" come let's play"); //this is indicating that the user can play after inputting the correct age } can be replaced by: else { System.out.println(playername+" come let's play"); //this is indicating that the user can play after … | |
Re: do you know how to analyze such an assignment and seperate the components of it? | |
Re: start with re-reading your code, and remove all that is making it less readable / efficiĆ«nt. else if(userage >= 8 && userage <= 13) { System.out.println(username+" come let's play"); //this is indicating that the user can play after inputting the correct age } Since all other flows are covered by … | |
Re: You don't really need arrays as far as I see. What you need are a few variables: a counter, to count how many (valid) inputs were read, the sum of those, and later you calculate the median by those. | |
Re: try with changing this: case 5 : System.exit(0); default : System.out.println("Please choose between 1 - 5 only."); to case 5 : break; default : System.out.println("Please choose between 1 - 5 only."); and put the `System.exit(0);` statement after your while loop. I don't really see why your code doesn't work (immediately), … | |
Re: This isn't working, because this will not compile. Java is case sensitive, meaning 'switch' and 'Switch' and 'case' and 'Case' are not the same things. | |
Re: well ... you're declaring keyboard twice, removing one of these 'll remove your first problem. after this, you also forgot to declare number as an int. if you adapt these two things, you're a lot better of, but you'll see your logic does not yet do what you want, but … | |
Re: Your problem is that you don't update the value of 'i' anywhere in your while block. This causes the loop to be repeated endlessly. When handling your 'incorrect answer', there you have a break statement, which breaks out of the loop. so: either update the value of i, or add … | |
Re: the UI is the last (and least important part) you should work on. Does your code work if you don't use a UI? | |
Re: what do you pass as arguments to your application? What do you expect it to do, and what does it do (not) ? ![]() | |
Re: I see no statement updating your db, so it's no wonder your DB isn't updated. | |
Re: And what is your actual question? | |
Re: Decide what type of development you want to do. This is quite important, since not every programming language is (as) suited for every programming task. The best way to start is to look into the official documentation, the official tutorials, and to buy a good book and start from the … | |
Re: what exactly is it you are unclear about? First you say you have "perfectly good working code", later, you say "I know its incorrect". Either it is perfeclty good working, or it is incorrect. What is incorrect about it? Do you get an exception? is it compile/ runtime? do you … | |
Re: one reason why a lot of people will ignore .jave, .class or .jar files (or other extensions from other languages): you don't actually know what the code does or will try to do on your system, and it might not be something you want it to do. | |
Re: you don't just mix html files and Java. You would need jsp or jsf files for that. Maybe you would do better to post with the jsp tag instead. | |
Re: Am I missing something? Yesterday, the tags were present if you opened up the subfora list with the blue button on top-right. Now, only the main titles (no tags) are present. Where exactly can we chose a tag to visit? Maybe a smaller remar (which I noticed by replying here), … | |
Re: The answer is Neither of those. public class Vegetable { private int calories; public Fruit (int calories){ this.calories = calories; } } This won't compile. You can't have a class called Vegetable, and have a constructor (in said class) of type Fruit. This won't compile. Let's assume you meant this: … | |
Re: ok? and what is your question? by your description, it seems to me your code works and does what it should do? | |
Re: Your original problem is this: if you call a print statement like that, the compiler will automatically print the result of the toString method, as told by earlier posters. If you don't override (specify for yourself) a toString method, it will take the toString method your class inherited from the … | |
| |
Re: you are way to vague. what do you mean: GUI ? even System.out.println("1. new"); System.out.println("2. open"); System.out.println("3. save"); System.out.println("4. exit"); can be considered as a rudimentary GUI. are we talking about Swing, JSF, JavaFX, JSP, GWT UI-binding, ... ? | |
Re: something that might make a difference between an anonymous inner class, and a named one is, do you plan to use it for several components? if so, it would be crazy to re-write the anonymous inner classes each time you want to use it, if you can just re-use an … | |
Re: setText ought to do it. You can provide scrollbars, if the text would be to long to fit in the size of the area. | |
Re: cyrusdude: the solution for his last issue was -> follow the java syntax. | |
Re: so ... What exactly is your question? | |
Re: First you say: > I just started learning Java. directly followed by: > I need to make a chat messenger project in java for my college project. very counter productive. you would do better to first learn Java. | |
Re: reggsoft, the code is up there (points up). If you can't write it yourself, copy paste it. There is no reason to re-open a dead thread. | |
Re: Sure there are tools out there to "translate" from (for instance) Java to Javascript (basically, the GWT framework generates javascript to run on the client's machine based on the Java code written by the developer) or from Java to a C variant. Does this mean it's always good to use … | |
Re: I like the new design, it's a more 'natural' look compared to the older, but just a few things I noticed first time seeing it. Usually, I directly go to the java forum (through a link in chrome, not through the main page) It is less clear what the Sticky … | |
Re: I'm not sure whether creating arrays for it should be considered a 'clever way' to do this. Usually, less resources used is better. Creating an array you can do without isn't necessarily clever. | |
Re: do you know what fiddler is and what it does? it's a proxy that provides information (headers) such as authentication headers. if fiddler is not active and your browser is configured to have fiddler provide certain information along with the request, the process 'll look for information that isn't there. | |
Re: what makes you think Facebook is better than Google+? they were built for different targetgroups, with different goals in mind. comparing them as being "that one is better" is ridiculous. they were not built for the same purpose, so there is no "better", they both are good for their targeted … | |
Re: * improve the number of items you offer * increase the advertisements * make sure you have better products compared to your competition * provide a better service then any other store * keep your prices low | |
Re: "display audio on jsp" ... the type of application you work with isn't relevant, whether it's a standalone using swing or javafx or a webapp using gwt or jsp/jsf, the persistence is not impacted by this. "but cannot upload only upto amount of kbs" what exactly do you mean by … | |
Re: don't expect us to download and run files we don't know. post all the relevant code here. | |
Re: Saranyasb: website promotion is very easy, if you want visitors only to visit once. if you want them to return to your page, you'll really have to put more effort in it. promoting a product start with making sure you have a very good product (just decent won't cut it) | |
Re: the language isn't changing at all. a lot of people are just either too lazy, too uninterested, or, in some cases, too dumb to learn and use it right. it's like driving a car. if tomorrow about every driver starts to hit pedestrians with their cars, will the point be: … | |
Re: video? are we talking video tutorials? about it? about how to cook? are we talking about promotional video's? are you trying to simply share your favourite music clips? what do you want/need it shared for? | |
Re: we don't know what type your objects are, so not going to talk about how to compare them. but, comparing them to 0? let's say all your elements are -1, then you'll get a wrong result. let's assume on the other hand, all your elements are positive, then each element … | |
Re: The problem you are having is indeed what syncster31 tells you. But just another advice, follow recommended naming conventions. public void setColor(String Colors) { color = Colors; } don't start variable names with a capital letter. Change the above (and all other places in your code like it) to something … | |
Re: just an example of what you could do: Create two lists: 1 filled with questions and answers 1 empty list Each time you display a question: remove this from the first list add it to the second list Each time again: generate a random question from the first list | |
Re: it would be a possibility. If you are going to do this, I would recommend to change the public String getColor(String color){ if(color.equals(GRAY50){ return backgroundColor; } return color; } part and other stuff linking the values and the actual enum, by what Joshua Bloch recommends in his book: "Effective Java, … | |
Re: With jsp what I'm expecting is jsp and Java code, this is pure Javascript. Is it possible you haven't pasted the right code? | |
Re: code like this is one of the main reasons I usually recommend to start moving every single line of your business logic out of your jsp files (which are really only supposed to implement the ui of the application) and into servlets. This code is an ureadable mess, so I … |
The End.