1,963 Posted Topics
Re: First of all, you didn't post a question, and second there is a link at the top of the forum created just for you: [URL="http://www.daniweb.com/forums/thread99132.html"]http://www.daniweb.com/forums/thread99132.html[/URL] | |
Re: I had an idea once of how to do this but I didn't like it very much. Here is what I have thought: Each cell (81 cells) will be represented by a Vector (perhaps an array [9][9] of Vectors). Each Vector will have numbers from 1 to 9. Suppose you … | |
Re: You create a new NOT null ARRAY that holds GameButton elements: [ICODE]grid = new GameButton[1];[/ICODE] grid is an ARRAY. But: grid[0] is a BUTTON and you never instantiate it. So the answer to your problem is quite simple: Example: [CODE] int N=5; grid = new GameButton[N]; for (int i=0;i<grid.length;i++) { … | |
Re: First of all: Next time post what kind of error you get and where you get it so we wouldn't have to search the entire code for the error. And second: This: [CODE] public static boolean isPalindrome(s) { } [/CODE] should be: [CODE] public static boolean isPalindrome(String s) { } … | |
Re: I don't want to sound ignorant, or pretend that I know everything, but does this code make any sense to you all? Because if the purpose of the code is reading a specific file then I don't think this is the right way. What exactly are you trying to accomplish? … | |
Re: [QUOTE=Ezzaral;759631]In what parameter? Are we supposed to look over your shoulder at what you typed? You create a new Scanner instance for each file in a list (or any other collection). If you're getting errors trying to do that, you need to post your code and the exact error message. … | |
Re: Check the tutorials at the sun website or buy a book about java. This thread was created especially for beginners like you. I am surprised you missed it. It is at the top of the java section: [URL="http://www.daniweb.com/forums/thread99132.html"]http://www.daniweb.com/forums/thread99132.html[/URL] | |
Re: I didn't read all of your code but I did notice these 2 lines: [ICODE]if (Operator == 'S')[/ICODE] Correct because Operator is char [ICODE]if (Operator=="S") [/ICODE] It won't behave the way you want it because: The "S" is a String object. The Operator is a [U]different[/U] String object. They might … | |
Re: [QUOTE=theraven82;758425]The IWT2_PO.transform method does not change anything to the first input argument. The first input argument to this function is immediately copied to a new variable. Also, shouldn't the input variable have a different scope anyway?[/QUOTE] If it is an object it is passed by reference. And when you say … | |
Re: I hope that you realize that this is wrong: [CODE] if(input == 0){ { } else(input == 1); } [/CODE] You should have this: [CODE] if (input==0) { } else { } [/CODE] OR: [CODE] if (input==0) { } else if (input==1) { } else { } [/CODE] | |
Re: Whenever you call this: [ICODE]System.out.print(element);[/ICODE] The toString() method of the object is automatically called. These 2 are exactly identical: [CODE] System.out.print(element); System.out.print(element.toString()); [/CODE] If you don't override the toString() method in your class the toString method of the super class is called and in your case the toString method of … | |
Re: You also want to read this: [URL="http://java.sun.com/javase/6/docs/api/javax/swing/JTextField.html"]JTextField[/URL] | |
Re: Link: [URL="http://www.netbeans.org"]http://www.netbeans.org[/URL] Apparently you want to download something. So click the download button and read carefully the page to find what you want. As for what is a source code, you think that the developers of NetBeans wrote the IDE using 0s and 1s. If you have written code and … | |
Re: What is your error? I hope that [I]flipCoin[/I] is not null | |
Re: Does you ATM class extends the BankAccount? If yes then in you ATM class you define only the ATM() constructor, without a super() inside it. Since you don't have a constructor like: BankAccount() in the super class, you get an error. Try adding this constructor in the BankAccount: [CODE] public … | |
Re: [QUOTE] org.apache.commons.validator Class UrlValidator java.lang.Object extended by org.apache.commons.validator.UrlValidator All Implemented Interfaces: java.io.Serializable [/QUOTE] I would suggest importing the package, and also downloading the appropriate jar file | |
Re: [QUOTE=PhiberOptik;754107]In your launcher you have to put the toString into a System.out.print or something like that for example: [CODE=java]public class AverageDriver { public static void main(String[] args) { Average object = new Average(); System.out.println(object.toString()); } } [/CODE] or [CODE=java] import java.swing.*; public class AverageDriver { public static void main(String[] args) … | |
Re: [QUOTE=leox99;750639]pls i need someone for help , make this program and help me pls ![/QUOTE] WHAT program?????? Do you see a program here? I don't see a program here. Assume that Yes, I would [U]love[/U] to make the program for you. Where is the program you want to be done … | |
Re: [QUOTE=ajithraj;752479]haii friends.. i want to search for a file, which resides in my own system using jsp...that is, when i click a button, a search brower is to be displayed which showing all my folders in my system and from that i want to search for the needed file...Is this … | |
Re: Just a few pointers to help you started: LEAVE the GUI part for last. I mean it. First solve the problem by writing only classes that have the methods you would want to use. For example write a separate class that read and writes from a file. Then test them … | |
Re: That is because you haven't defined such a constructor in your Lottery class. Come on you could have figure that out. Put some effort into it | |
Re: Actually what you wrote [I]umairsario[/I] is wrong, and other good programmers will agree with me. Actually I dare to call it stupid. If I was thinking your way I good make a better (and more stupid) program: [CODE] System.out.println("0 1 2 3 4 5"); System.out.println("1 3 5 7 9"); System.out.println("3 … | |
Re: [QUOTE=umairsario;750757]can you please explain in your words[/QUOTE] I have read the links and they are very explanatory. It says more than I could have posted. Plus it has examples you can look | |
Re: [QUOTE=ITlang007;749887]Thanks man, yea that is true but I'm making sure because it is my assignment.[/QUOTE] Can't you compile ti and run it? Also try to add some elements in the ArrayList and then use a for loop to print them. Do you know how to find the API for the … | |
Re: You will create separate classes for your employees and they will have the attributes that are described in your assignment (name, hourly paid, ... ). Then the user eneters 'N' you will read the input specified, create a new object 'employee' and add to a list of employees (Use the … | |
Re: [QUOTE=anez247;748348]hey peeps..i got a problem in this project and will be grateful if someone can help pls..thx[/QUOTE] We can't help you. No one here has ever done an invisible project. Tell us what is the project and post the code you are having problem with. | |
Re: First of all, the javadoc goes outside the method. Second I believe that you get the error when you run it? If it is true, then I think the 'hand' Vector doesn't have inside it objects of type Card. What do you put inside the 'hand' ? [CODE] /** * … | |
Re: This: [CODE] public class Rolling { private random myDie; } public static void main(String[] args) { } [/CODE] Should be: [CODE] public class Rolling { private random myDie; public static void main(String[] args) { } } [/CODE] | |
Re: One way that came to mind is use 2 for-loops | |
Re: Try closing the writer: [icode]//writer.close();[/icode] Why did have that line in comment? Remove the comment | |
Re: [QUOTE=poggie;745150]you will want something like; [code] for (int index=0; index <numbers.length; index++){ //Statement printing the number ie. 0, 1, 2 ,3...etc for(int index1=0; index<numbers.length; index1++){ //statement printing thestars } //statement toprint new line } [/code] you cannot put the printstatement comtaining the | and the \n in the inside for … | |
Re: Are you familiar with the 'append' argument of the FileWriter ? [CODE] BufferedWriter writer= new BufferedWriter(new FileWriter(file, true)); [/CODE] When you try to write to the file, the new data will be appended [B]after[/B] the existing | |
Hi there, Does anyone know any good books for Struts 2? I have tried reading: Struts 2 In Action, but I wasn't very thrilled about it Thanks | |
Re: You can have a Submit button and when you select the menu, and press the button, you submit to a Servlet, take the value of the drop down box and according to that redirect: [CODE] <select name="menu"> <option value="java">Java</option> </select> [/CODE] When you submit and do [ICODE]request.getParameter("menu")[/ICODE] It will return … | |
| |
Re: First of all do what [U]stephen84s[/U] has suggested, don't put java code and logic in jsp. Only code that displays results. And you should use ONE big try-catch and put everything inside. The idea with try is that you don't put only the line that has the exception, but also … | |
Re: Don't worry everybody does that mistake. And I am tired of replying to it. Just use the equals method. When you use '==' to compare String (remember Strings are Objects) you compare to see if they are the SAME objects. They are not, but they have the same value: [CODE] … | |
Re: When you are creating a new user, are you checking if the user already exists before performing an INSERT? Perhaps the mobileNo should be declared as Primary Key. Then if you try to insert a new row that has the same mobileNo it will throw an SQLException. Or if you … | |
Re: [QUOTE=BestJewSinceJC;743104]Programmers are never in shape... always either skinny or fat or pudgy... hardly ever muscular or physically active[/QUOTE] Not true. I was a fencing champion in my country. My colleague who sits next to me should be working as a bodyguard with all the muscles he has. And the guy … | |
Re: Look at your code: [CODE] for (line = lnr.readLine(); line!=null; line = lnr.readLine()){ String account[] = new String[4]; int count = 0; int accountNumber[] = Integer.parseInt(account[count][1]); int pinNumber[] = Integer.parseInt(account[count][2]; int balance[] = Integer.parseInt(account[count][3]; String name = account[count][4]; System.out.println(accountNumber[0][1]); } [/CODE] You read the line BUT inside the loop you … | |
Re: With this code you can read files: [CODE] File fileName; //OR String fileName; BufferedReader reader = new BufferedReader(new FileReader(fileName)); String line = reader.readLine(); while (line != null) { //do whatever you want with the line read. //perhaps append it to the TextArea. line = reader.readLine(); } [/CODE] | |
Re: Read the file for its data. Then use that data to query the database: Run an UPDATE to record you want to update. Learn how to read files. Learn SQL. Learn how to run queries with java. | |
Re: [CODE] Vehicle vehicles [] = new Vehicle[5]; int i; vehicles[0].initializeVehicle(18000.00f, 2007, "Nissan", "Sentra"); [/CODE] vehicles[0] is null. You need to do: vehicles[0] = new Vehicle(); [B]or[/B] vehicles[0] = new Vehicle(price, year, make , model); Also, I could not find where the initializeVehicle method is declared. It should be put in … | |
Re: In Physics everything is measured in meters and seconds. So after you get the speed and distance, Convert both to meters/sec and meters. After you do the division you will have a clean value in seconds which can be easily converted to minutes and hours. If the final value has … | |
Re: Every time you do: [ICODE]Time application = new Time();[/ICODE] you create a new object and therefor you reset the values back to zero. So create only ONE object (do this once: [ICODE]Time application = new Time();[/ICODE]) And then use the application instance to change its values. By the way, the … | |
Re: I hate to break it to you [I]mahaboob Basha[/I] but this is not the right way to do this thing. Firstly you need to put DB functionality out of the Servlet. Secondly Servlets are hardly used for generating GUI. (Use JSP) | |
Re: I think you have misplaced the parenthesis: This: if (!Character(userPass.charAt[B](index == 'c')[/B])) Should be: if (!Character(userPass.charAt[B](index)[/B] == 'c')) You could also try: [CODE] goodSoFar = userPass.equals("cool"); return goodSoFar; [/CODE] | |
Re: When comparing Strings, almost at 99.99% of the cases, you will need to use the equals method: [CODE] String s1 = "aa"; String s2 = "aa"; System.out.println( s1.equals(s2) ); //it will print true System.out.println( s1.equals("aa") ); //it will print true System.out.println( "aa".equals(s2) ); //it will print true System.out.println( s1==s2); //it … | |
Re: Try to leave the GUI out of it at the beginning. First write a class that will represent the data you will be saving. Then in a separate class write methods that read and write to a file, a List (ArrayList, Vector) of DVDs. Test the above in main method. … | |
Re: I think you are contradicting yourself: [QUOTE=IMtheBESTatJAVA;735054] I didn't even necessarily ask you to do the entire thing[/QUOTE] [QUOTE=IMtheBESTatJAVA] If anyone can do this I will spam +rep on your for the remainder of your DaniWeb life[/QUOTE] [QUOTE=IMtheBESTatJAVA] it takes me too long to figure out how to fix all … |
The End.