4,084 Posted Topics
Re: you did not write any code to actually write anything to your file. take a look at the [URL="http://docs.oracle.com/javase/6/docs/api/java/io/PrintWriter.html"]PrintWriter api[/URL] and check what the print method does. also, if you're not sure whether you've placed your file in the correct place, don't create it manually, but let your application create … | |
Re: it does run but: [Code=Java] public static void main (String []args){ } [/Code] your main method is empty. | |
Re: what problem? what is your actual question? for future reference: to make your code a bit easier to read, could you put them between ['Code] ['/Code] tags? (without the 's off course :) ) | |
Re: how do you get this message? if it's just a line printed in the console, or a messagebox, instead of a stacktrace, it's very possible that this is not an "error", but programmed to hapen so. for instance: the programmer added a validation: if currentYear > 2011 -> print "this … | |
Re: if it's a String, you can use the indexOf method to find the location of the substring you need to replace, and replace that char with X. there are various ways to do this, normally, all you need to complete this task is in your syllabus in the chapter(s) you've … | |
Re: you need to set the value of the text of the textarea, and you need to add the textarea to the panel. I also suggest you to declare your textarea on class scope, that way you will be able to (re)set the value of the text in the textarea. | |
Re: well, start off with the analysis. when you're done with that, check it, to decide what objects you need, and what functionalities these objects must provide. make sure you also know the dependencies between the objects: do you need to inherit objects, do you need to use interfaces somewhere, ... … | |
Re: define "When I'll master them" it is practically impossible to completely 'master' a language like Java, cause of the broad supply of (non-)commercial frameworks and libraries out there. you can off course become very good at the basics, and specialise in certain frameworks, which would make you a wanted asset … | |
Re: well, I never used SWT myself, so I don't think my personal experiences can give you an answer, but I did find [URL="http://www.eclipse.org/articles/article.php?file=Article-Swing-SWT-Integration/index.html"]this article[/URL] which may help you out. | |
Re: what error message do you get, and what does it depend on? also, you may want to replace your | comparators by || comparators (basicly, they do the same work, but the second one will only check the second expression if it still needs to be checked) I just tested: … | |
Re: [QUOTE=dany12;1724293] you have a class main in witch you have all the functions and methods.[/QUOTE] this statement is not really correct. you can call your class Main, but you don't have to. you could also call your class Dog and add methods like goFetch and playDead. all your methods do … | |
Re: properties files are not really related to Swing or any other framework that deal with the UI. to create a properties file, all you need is a text editor. if you mean you want to know how to have several languages in your application that the user can switch between, … | |
Re: [QUOTE=csanuj;1724743] You don't have any right answer of your own[/QUOTE] and I wouldn't bet on that either :) | |
Re: [QUOTE=Majestics;1724358]Well its just a question... I saw it in a book and answer's are these.... I just want to know the pofessional suggestions[/QUOTE] have you checked the book itself? normally somewhere in the book there's a list of the correct answers that come with explanations of why the answers are … | |
Re: your stuck at what exactly? also, since you're shapes are not primitives, and ev.getSource returns an object, use the equals method to check for equality. | |
Re: normally, I don't think you can't 'switch' from delimiters while splitting the String already, but, if the part between "'s is the last part of your inputstring, you could first split the original String using the indexOf and substring methods of the String class, so you would have as original … | |
Re: what exactly do you put in as input, and what do you expect as a result? | |
Re: what exactly do you mean? running it when you press a button, running it after the page has loaded with a time-interval, ... ? not sure what you mean, but I'm pretty sure there 'll be a javascript or jQuery library "out there" that can do exactly what you want … | |
Re: what exactly do you mean? your explanation makes no sense, it's like saying: I'm writing a method add() or multiply() which has to be able to take a String as well as a Double, and has to be able to be applied to as well a String instance as a … | |
Re: what have you done so far? write a project that deals with data as you need it, first with dummy classes that don't write anything into a database. then, use 'ye olde [URL="http://www.google.com"]Google[/URL]' to search for database connection and jdbc, and see where that 'll get you. I have no … | |
Re: not to mention the fact that in that other thread, he claims the problem is solved. | |
Re: you need to give your variable p a default value, either where you say: [Code=Java] int p; [/Code] you should say [Code=Java] int p = -1; [/Code] or, in your if-else statement: [Code=Java] if (u == user) { System.out.println ("Enter Password:"); p=s.nextInt(); } else { System.out.println ("Invalid User"); } [/Code] … | |
Re: [QUOTE=mrjillberth;1716031]In line 4, there should be no semicolon because you are stating an if-statement. You should use curly braces either.[/QUOTE] congratulations ... you just made two posts full of information already provided by zeroliken and hfx642. if there was something like copyrights on this forum, you would be f*cked ==>> … | |
Re: that would depend on the topics handled in in your course. also, you'll find examples in most books, but expecting a complete application as an example is a bit far fetched. if you want to know about good books, I would recommend looking at the sticky thread on top of … | |
Re: what do you think this is doing? [Code=Java] array[i]= input.nextInt(); copyarray[i] = array[i]; if ( array[ i ] == copyarray[ i ] ) System.out.println("plz enter other element because uoyr element is already exist"); else System.out.println("\n "+array[i]); [/Code] you set both values to the same value, so they are equal in … | |
Re: [QUOTE=songokute;1722768];)) That's Fibonaci? If n = 4, it returns 3, => it's not true![/QUOTE] actually, for n = 4, 3 is the correct result. what you can do is something like this: [Code=Java] int n = input(); if ( n < 1 ) System.out.println("ERROR"); else{ int number = 1; int … | |
Re: well .. on my previous projects one of my co workers had to do something similar, and he called the webservice from within his javascript, passing the value as a parameter. maybe you could google it? by googling 'call a java webservice from javascript' I got a lot of responses, … | |
Re: what mistake? is it a programming error? do you get an error message? or is it a logical error, and you get a different output then expected? | |
Re: a bit late, but two other possible approaches you could have taken: after you found the highest number -> remove that number from the array and use the exact same algorithm (you would have to remove all occurences of the highest number) or (easiest) you could have sorted your array … | |
![]() | Re: this is not an 'ultimate guide', this is just one site giving basic information. if you truly want to learn java development, you may want to check the sticky thread on top in the forum. ok, you get to 'do' a lot of programs. is there a way to verify … ![]() |
Re: nope ... he just delegates a lot. why do you think Ireland is overrun by leprechauns? | |
Re: what have you got so far? I hope you've gotten just a bit further than just the assignment? | |
Re: well, you can work with div's, and, based on the value you select, change the style of the div from (for instance) <div id="firstDiv"> </div> you can use javascript to set the class used for the element with id="firstDiv" to - hidden - shown - small - large ... depending … | |
| |
Re: or, if you reeeaaally want to prove you're a hardcore coder, you can write a second app, put that in a jar, place that on your desktop and call your first app with that. off course it's very inefficiënt, you'll have to change your code each time you move your … | |
Re: replace [Code=Java] String strLine; //Read File Line By Line while ((strLine = br.readLine()) != null) { [/Code] by [Code=Java] String strLine = br.readLine(); //Read File Line By Line while ((strLine != null) { [/Code] If you look closely, you'll notice you call the strLine = br.readLine(); within your loop as … | |
Re: looks pretty good to me, and yes, that is a nested-if structure, although here you could use the else if instead of else{ if () .. } most of the times, you'll find nested if's in the form of [Code=Java] if ( expression1 ){ if ( expression2 ){ } } … | |
Re: [QUOTE=matheswari;1720501]whether it is possible to validate input in a textfield using core java?[/QUOTE] answer is the same as the answer on the question: is it possible to start a new thread for a new question? | |
Re: you're never going into the while loop that is supposed to enter the numbers in your arrays. take a look at [Code=Java] import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.Scanner; public class Test1 { public static void main(String[] args) { Scanner key = new Scanner(System.in); System.out.println("Enter the name of the … | |
Re: you may want to show us the code for the entire shape class | |
Re: take a look at [URL="http://docs.oracle.com/javase/tutorial/java/concepts/interface.html"]this[/URL] in an interface, you can declare methods, you just don't give them a 'body'. which means: [Code=Java] public void play(); [/Code] is allowed [Code=Java] public void play(){ } [/Code] is not. the implementation of these methods is done in each (non-abstract) class that implements the … | |
Re: how about starting a new thread? this has been a dead thread for years. anyway, you may want to try the ** DRUMS ** (wait for it) getDate(..) method of the ResultSet class. just check the [URL="http://docs.oracle.com/javase/6/docs/api/java/sql/ResultSet.html"]api[/URL]'s, which should have been your first step. | |
Re: welll ... if it works, why do you assume this one does not qualify as being a "right" host name? (it's actually the host's IP address, not really a hostname) | |
Re: problem with scope you're declaring and initializing A within your try block. put the A.play(); call also in the try block | |
Re: also, IMHO, if you would submit what you've explained us you did so far, you would be getting an F as well.. try this, instead of your: {"one","two","three","four", ...."Nine hundred ninety nine thousand ..."} approach: read your number: divide by hundred thousand and don't forget to store the rest of … | |
Re: no can do as far as I know .. just cast your long to a String, and write that. when you read your file, cast the String you write back to a long. | |
Re: then still comes the question: do you want to PLAY the game yourself, or have it played for you while you pay extra for it? isn't it more fun to do the actual building of your character yourself, rather than to wait until someone else made it strong enough to … |
The End.