4,084 Posted Topics
Re: another possibility is by adding an implementation of the KeyListener interface to your textfield. there are several ways of doing what you're trying to do, just look at your application, whether you need it once, twice, a lot of times, in one java class, in several java classes, ... | |
Re: or add a break statement once you've found the name. another possibility would be: if ( names[k] != null && names[k].equals(user)){ .... } this way you'll only call the equals on it if it isn't null, and that way, you avoid the nullpointerexception | |
Re: Is map a map, list, collection, array filled with (only) objects of the type Customer? | |
Re: early start: pseudo code. let them grasp the logic behind the code, and later on choose a language, and show them how to transform [Code=PseudoCode] read number set number2 to 0 do while number2 < number - print number2 - add 1 to number2 [/Code] into actual code. there are … | |
Re: depends on more than just that. do you need it often? is it always the same query? do you have rights on the DB? ... | |
Re: do you know what threads are? | |
Re: the problem is, you don't have a method called 'delete' without parameters. that's why it can't find it. | |
Re: Abira: learn how to read dates (and previous posts) this is an ancient thread that shouldn't have been revived. secondly: learn how to use a search function. this question has been asked more than filosofers have debated over the "chicken - egg" problem. there have tons of suggestions been given … | |
Re: do you know what event throws an ArrayIndexOutOfBoundsException? let's say you have an array of ten ints: int[] row = new int[10]; the first index for this (and every other) array is 0, the highest possible(last) one is 9 (10-1) so, if you call int a = row[x]; with x … | |
Re: also: getoutput is not the same as getOutput java is case sensitive. you are telling your method not that you are passing a color, but you are passing the (non-existant) variable getoutput. //the add function in the pen class public int add(String c) { System.out.print(c); return 0; } why exactly … | |
Re: well, if you plan to write a functional application in java, knowing how to write decent java code is a must. when you feel your knowledge of core java is sound enough to start on it, first create a decent analysis. that will tell you what object's you need to … | |
Re: > write this for me, I just have no idea where to start and need a little push into the right direction. > Thanks! are we talking html files? in that case, look for a html parser in java | |
Re: first, learn the basics. an if statement is not a loop. also, be beware that anyone can lie in forms like that, so don't consider it to be "fool proof". for the rest, all the above kind off sums it up. | |
Re: since a lot of companies haven't switched to 7 yet, version 6 I can understand, but as JamesCherrill says: it's risky. anyway, you may want to try the indexOf method | |
Re: which still doesn't make it java, this is an sql matter. > jobs (priority, date, deadline, material, status) VALUES (?, ?,?,?,? ) select customerID from Customer where CustomerID =?" seems to me you have two sql statements and try to run them as one. | |
Re: although most would perfer the use of mutators instead of directly trying to access (private) instance variables | |
Re: for me, I'm an atheist. not that I don't approve of (some) things they do/stand for, but more like ... you will not kill, you will not steal, ... according to christianity, if you hold yourself to these 'standardized' rules, you are a good Christian. according to me, if you … | |
Re: twmgeo: this thread is four years old, and there's no use reviving it; if you want a list of books to look at, just take a look at the sticky thread on top of the java forum. as far as I understand you, you will only be using very basic … | |
Re: polymorphism isn't only achieved by extending classes, but also by implementing interfaces. | |
Re: if your client tells you, you're not allowed to use a certain technology, don't go all high and mighty and think: I'll write it in that langauge/framework anyway, because I can make it really good-lookin', or very professional or efficiënt. if your client tells you not to use something, they … | |
Re: how do you seperate your different parts? is there always a space between the 'value' and the operators or not? | |
Re: well, if you let us know what errors you get now, we might be able to help easier > interestRate = keyboard.nextDouble(); I assume the above line gives you problems? you have to declare variables before using them. | |
Re: do you havd those variables declared as instance variables? we can see you didn't declare them at the beginning of the class, but, then again, java does allow declaring them anywhere. if you haven't: this. refers to the current instance. this.first refers to the instance variable first of the current … | |
Re: one mistake you are making, is that we don't see any of the relevant code, so it's impossible for us to see whether there's something 'odd' in it. | |
Re: it's the enhanced for loop. String[] myStrings = {"one","two","three","four"}; for ( int i = 0; i < myStrings.length; i++ ) System.out.println(myStrings[i]`); does the exact same as String[] myStrings = {"one","two","three","four"}; for ( String tempString : myStrings ) System.out.println(tempString); | |
Re: you'll need to put your check whether or not your number is higher than the currently stored one within your while loop, or you will only check whether the last number entered is greater than 0. this is not really a java issue, as much as a logical one. write … | |
Re: ChrisHunter: javascript can be used for functional tasks as well, css is more style related. java and javascript may have a lot of similarities, still they are different languages. whereas you can write complete software packages using java, both in a web application as stand alone desktop application, javascript code … | |
Re: you are comparing an array of Strings against a single String. looks like very bad coding. if(possibilities.equals(possibilities[0])){ | |
Re: do you have another file called Pritish.java ? | |
Re: what to do? first you realize that this thread is two years old, and nobody is still following it. secondly, create a new thread in which you ask your question. there are thousands of things that can go wrong, but what it is is pretty hard to know if we … | |
Re: besides, are we talking an actual next page, or do you mean pagination, which is another matter. try something yourself first, and be clear in formulating questions you have. | |
Re: > But why does printing out a3 uses toString() method from class B? it doesn't. but, you stated: a3 = b3; from that moment on, a3 actually is an instance of B, that's why it'll look for the toString method in the B class first, only if it doesn't find … | |
Re: I doubt it, but won't kill you to look for it, I guess. | |
Re: to find the best sites, best place to start looking is that new thing ... the internet. the trouble with those in bookform, is that it's a real pain trying to find a link that's not dead :P as for contents, that depends on what you're interested in. if you're … | |
Re: you set the values of those variables in try blocks, but since an exception can be thrown, it's impossible for the compiler to say whether they'll be initialized or not. he has to check for worst-case-scenario, which means, he assumes they aren't initialized. if you want to solve this, you'll … | |
Re: can you show the code where that exception is thrown? | |
Re: just because your code compiles, doesn't mean it makes sense. take this code, for instance (snippet of your code) if ( a[i] == true || setB.a[i] == true ) u.a[i] = true; what exactly do you hope to accomplish there? I assume you noticed this, but a is a static … | |
Re: The reason why you get errors you don't understand, is because you didn't bother to try and understand what was going on, you just copy-pasted the codebase out of [this thread](http://www.daniweb.com/software-development/java/threads/153273/java-program-cd-player-need-some-help-please#post1812319) without knowing anything about what files the OP had on his system. you didn't even bother to rename the … | |
Re: keep an int on class scope, that way the value will remain through running your method several times: just to give you an idea: int aid = 0; private void simpleNumberKeyTyped(java.awt.event.KeyEvent evt) { if ( aid != 0 ) aid *= 10; int n=0; char k=evt.getKeyChar(); if (!Character.isDigit(k) ) // … | |
Re: big mistake, quite basic to the OOP principles. the == operator is not used to check for equality of values of Objects. if you want to check whether or not two Strings have an identical value, you need to use the .equals method. if you want to convert hiddenword to … | |
Re: because you didn't code it to read the file. you've just set that he should get his input from that file, but you're not letting your instance of Scanner actually read the input. | |
Re: Anand01: it's maybe a bit late for this response, but anyway: in this example it should indeed be an int, but starting from java 7 it is possible to use a String variable as value in a Switch, there's an example in the link you've posted. so it just depends … | |
Re: I'm not sure what it is you're trying to do, but you can always use interfaces to make it possible for your listener to 'command' your other class | |
Re: depends on what you want to learn. for some it is easy to learn different languages, others prefer to stick to one, and become very good at that one, and using frameworks written in it. so, it's about figuring out what kind of software you want to develop, and choose … | |
Re: I haven't read your entire code, but I think he means that you are overwriting (hiding) some of your class variables in smaller scopes, and updating those local variables. but since you re-declare them, the value of your class variable isn't updated when you change the local one, so when … | |
Re: read the sticky thread on top of the java forum. it's filled with recommendations of good java books and sites. | |
Re: [QUOTE=happygeek;1778522]I became a grandad for the fourth fine today. Gracie is beautiful. Later thus week I will find out if I am going blind in one eye and how long that process will take, and importantly if it will spread to the other eye. Final tests on Friday, in the … |
The End.