1,963 Posted Topics
Re: [QUOTE=achieve_goals;1184342]Actually I have to make a hashtable. My data is in a datafile and I have to retrieve data from that without using Java Class Library, that means I cant use import java.io... I have to take first two words to be the key and then the next word to … | |
Re: Post your error messages. Also you have a method: [B]setRadius[/B] Why don't you use that instead of this: myCircles.radius = input.nextDouble() What's the point of having it? | |
Re: You are using something which is null. The error tells you the line where that happened. Also you are trying to close the 'stmt' variable but you are using the 'pstmt' to execute the query. | |
Re: 2 for loops. Outer: 1 to 5 for the lines. Inner: Depending on the index of the first loop you will decide how many stars will be printed. The number of stars will be the number of times the inner loop will run. Also: [B]System.out.println()[/B] : Changes lines [B]System.out.print("*")[/B] : … | |
Re: You haven't given us much to work with. You might want to create a "Food" class. Maybe you should also create subclasses of the "Food" class for different foods. And perhaps different foods can be inputted in specific types of machines so you have some business logic here. Have a … | |
Re: [QUOTE=aomran;1182259]the only way to kill it is to inter a character and not an integer. sc.hasNextInt() suppose to return a boolean true if the next token is an integer and false if anything else [B]including eol.[/B] [/QUOTE] Well apparently the last part is not correct. I just checked the API … | |
Re: Assuming that their files are classes with methods, then in your swing class, you will have instances of those classes. Then according to what the user clicks you will call the methods of those classes and display the results. If those classes have main methods, then they are doing it … | |
Re: First of all, write a main method in a separate class and test the ParseClean in order to see that it works. Then post some more code of the a.html file so we can see how you submit the form. And finally don't use this: [ICODE]out.println(ch.ParseClean(trans));[/ICODE] Use this: [CODE] <%@page … | |
Re: The NumberFormatException tells you that what you used as argument is not a number. It also says that the value you passed is the String: undefined [QUOTE] threw exception java.lang.NumberFormatException: For input string: "undefined" [/QUOTE] That would mean that the value of rowsPerPageStr is the String: "undefined": [ICODE]String rowsPerPageStr = … | |
Re: [QUOTE=sweety roy;1181095]* *** ***** *** * display the output as above using c++ or c[/QUOTE] This is a java forum. Start a new thread in the C forum but don't expect people to give you the answer if don't show some effort and post what you have done so far. | |
Re: Use the equals method to compare Strings: [CODE] temp2.equals("/") [/CODE] | |
Re: First of all don't do this: [CODE] public Card() { Card card = new Card(); } [/CODE] When you try to create an object you will call the constructor. Inside it you call this: [ICODE]Card card = new Card();[/ICODE], which will call the constructor, but inside it you call this: … | |
Re: [CODE] public class testAssert { public static void main(String[] args) { int x = 5; int y = 7; boolean b = x!=y; System.out.println(b); } } [/CODE] | |
Re: Because the [ICODE]x.substring(0,200)[/ICODE] throws a StringIndexOutOfBoundsException not a TryCatchException1. If things worked the way you thought then when people do this: [CODE]try { } catch (NumberFormatException e) { } catch (SQLException e) { } catch (Exception e) { } [/CODE] Then the other exceptions will never be caught and everything … | |
Re: Write if statements. Have a method that takes as argument what you want and return the other. You say that the uses enters the grade and expects to see the grade point [CODE] public void nameTheMethod(Stirng grade) { if ("A".equals(grade)) { System.out.println(4.00); } else if ("A-".equals(grade)) { System.out.println(3.7); } else … | |
Re: [QUOTE=vchandra;1175595]like that it will not set the file path correctly. so instead of File inuse = new File(temp) you need to write File inuse = new File("c:\\test\\"+temp) cheers[/QUOTE] [I]vchandra[/I] is right. Also it is a good thing always to check the API of the classes you are using. Why did … | |
Re: First of all always use {} brackets. Look what you wrote: [CODE] if(arg == "Exit") System.out.println("Program Terminated."); System.exit(0); [/CODE] And what I wrote: [CODE] if(arg == "Exit") { System.out.println("Program Terminated."); System.exit(0); } [/CODE] In your first code, if the [U]if statement[/U] is true it will execute only the [B]System.out.println("Program Terminated.")[/B] … | |
Re: At the btnOkActionPerformed whenver the button is clicked, you read the file and the you add the new DVD to the list. It is not necessary. You need to read only once the file and sotre those value at the list. Of course I don't know the purpose of that … | |
Re: You throw it, but you don't catch it. Exceptions tend to terminate your program in a bad way. You need to catch them so that it won't terminate your program: [CODE] public static void main(String args[]) { A a = new A(); int x1; int x2; x1 = 7; x2 … | |
Re: This code: [ICODE]private Employee e = new Employee("ME","MYSSN");[/ICODE] calls the constructor. [CODE] public class Employee { [B][COLOR="Red"] private Employee e = new Employee("ME","MYSSN");[/COLOR][/B] public Employee(Employee e){ this(e.name,e.SSN); } [/CODE] When the constructor of a class is called you create an instance of that class and its attributes are declared and/or … | |
Re: Probably because in the while loop you have code that sets the balance to the initial amount. Put that piece of code outside the loop. I think that it happens here: ca.setInitial(checkingAmt) . You keep asking for the user to enter initial amount in the loop. | |
Re: Why, have you given any effort? In the entire thread, vchandra has been given you the answer even though it is against the forum rules. You have showed no effort from your part. You just took the code, run it, and report back what you didn't like in order to … | |
Re: Then post what you have done so far. The code that there is in the txt is not complete and doesn't compile. You are missing the closing brackets | |
Re: Are you getting compile error? I am not familiar with C#, but If we assume that the concatenation works the same then maybe this is the problem: This: [CODE] <script type="text/javascript" src="<%=ResolveUrl"jquery.js"%>"></script> <script type="text/javascript" src="<%=ResolveUrl"JScript.js"%>"></script> [/CODE] Should be like this: [CODE] <script type="text/javascript" src="<%=ResolveUrl + "jquery.js"%>"></script> <script type="text/javascript" src="<%=ResolveUrl + … | |
Re: [CODE] p.println ("This is written to a file"); [/CODE] That is what is written to the file. I can't understand what is the problem. It writes whatever you want it to write. If you want something else written then put whatever you want written in that code: [CODE] p.println ("This … | |
Re: [QUOTE=AngelPriya;1174560]K ILL NOT REPEAT THIS AGAIN....Send me d coding...[/QUOTE] Repeat what? Where are you having problems with and [U]what is your question[/U]? Just because you send me [B]3 PMs[/B] it doesn't mean that everybody can read my messages and [U]nobody knows your question[/U]. And hijacking an old 1-year old thread … | |
Re: Your question doesn't make much sense but I will give you an example in case it helps: PAGE 1: [CODE] <a href="page2.jsp?name=someSchool&address=someA&number=11">Link in page 1</a> [/CODE] PAGE 2: ([B]page2.jsp[/B]) [CODE] <% String name = request.getParameter("name"); String address= request.getParameter("address"); String number= request.getParameter("number"); %> <a href="page2.jsp?name=<%=name%>&address=<%=address%>&number=<%=number%>">Link in page 2</a> [/CODE] Inside the … | |
Re: It is because you enter to the stack character by character: [CODE] theStack.push((int) (ch - '0')); [/CODE] Meaning that this input: 10+2, will be entered in the stack like this: 1, 0, +, 2 You want this: 10, +, 2 Try this: [CODE] String s = "10+2-3/4*11"; StringTokenizer st = … | |
Re: After reading the requirements they are pretty big, but most of all pretty explanatory. And given the introduction, I don't believe that you are required to do them all at once. So at which point are you having problem with. What do you need to implement at first. The pdf … | |
Re: If I understood correctly your problem I think that you lack the basic of Maths. I assume that a PolynomialTerm is this: aX^b: 4X^3. If x=2 then the above would be: 4*(2*2*2) = 32 Then the addition can only be done only when the exponents are the same. You cannot … | |
Re: [QUOTE=afruja;1169298]i want to disable forward and back button of IE in jsp page[/QUOTE] Perhaps it would be better to tell us WHY you want to disable the forward/back button. Maybe what you are trying to achieve can be done in another way than disabling the buttons. | |
Re: [CODE] [COLOR="Green"][B]Scanner scan = new Scanner(System.in);[/B][/COLOR] //enter 10 scores String score = ""; for (int i = 0;i<= scores.length-1;i++) { try { System.out.println("Enter Score " + (i+1) + ": "); [B]s[COLOR="Green"]core = scan.nextLine();[/COLOR][/B] scores[i] = Integer.parseInt(score); } catch(Exception e) { System.out.println("Value entered: "+score+" is not a number"); System.exit(1); } } … | |
Re: It means that such a constructor doesn't exist. Look at the Employee constructors. What do they take as argumentand what does the [B]myStore.elementAt(i)[/B] return? [CODE]u=new Employee(myStore.elementAt(i)); [/CODE] Also shouldn't you be doing this: [CODE] u=(Employee)myStore.elementAt(i); if(txtName.getText().equals(u.name)) { txtName.setText(u.name); txtPhonenum.setText(u.phoneNo); txtNi.setText(u.natInsceNo); } [/CODE] | |
Re: [QUOTE=mytime19;1170694]try this [CODE] public class Battleship{ public static void main(String[] args){ int boardInput = Integer.parseInt(args[0]); } }[/CODE] Cheers[/QUOTE] That is correct, but I would prefer something like this: [CODE] public class Battleship{ public static void main(String[] args){ if (args.length>0) { int boardInput = Integer.parseInt(args[0]); } else { System.out.println("No arguments given"); … | |
Re: Just create the labels, buttons and textfields like the example. Check the API for what you need to use. When the radio buttons are clicked get the value of the text field like the example. Look the API of the JRadioButton and see what Listener to use. Use the getSource() … | |
Re: Try to print it and then run it to an sql client or an sql editor and see what is the problem: [CODE] .. String query = "INSERT INTO WeatherHistory (Date, Location, Overview, Temperature, WindDirection, WindSpeed, Pressure) VALUES ('"+date+"','"+location+"','"+temp+"','"+windDir+"','"+windSpd+"','"+pressure+"')"; System.put.println(query); prepStat = connection.prepareStatement(query); [/CODE] Take what is printed and run … | |
Re: In a separate class or in one of the ones you already have, put that method: [CODE] public static void main(String [] args) { // instantiate objects and call their methods } [/CODE] Inside it you will put the code that you want executed. Then you will run the file … | |
Re: I don't know if it can be done but instead of using the ActionListener interface, you can use the MouseListener interface. Check the API of the JButton to see if it can accept such a listener. If yes, then look at the methods that it has. Also when you drag … | |
Re: Have you defined a Connect4Column class? Also I have given suggestions in the other thread which you didn't follow. (About the ';'). The constructor seems ok though. If it is the same as before then I must have missed something. Next time use Code tags. Press the button: (code) when … | |
Re: Look at this: [CODE] Connect4Model(int numCols, int numRows); constructor { [/CODE] You have a semicolon after the parenthesis. It means that you ended the command there and the rest: [ICODE]{...}[/ICODE] are not inside the constructor. Don't use ';' at the declarations of methods. In methods like this: [ICODE]int getCounter(thisColumn, thisRow)[/ICODE] … | |
Re: After you call the second query, do you check if there were any rows returned before calling the rs.getString ? [CODE] // Maybe you should do this: rs1.close(); rs1 = st.executeQuery(ssql2); // And this: if (rs1.next()) { buffer = rs1.getString("balance"); } [/CODE] You also don't close the rs, the st … | |
Re: The method createInvoiceItems is declared inside the class ProcessInvoice class. But you are doing this: [ICODE]invoice.createInvoiceItems()[/ICODE] The Invoice class doesn't have the createInvoiceItems method the ProcessInvoice has. Also I don't think it can be called from outside the class ProcessInvoice if it is private. Also I suggest that you initial … | |
Re: Do you take the text from the JTextPane, and do you write it to the file? | |
Re: Where are you having problems? Reading the file or doing the formula. The above are 2 different things. First write a method that reads a file and returns a double array. I assume that all data in the file have 10 seconds difference. [CODE] public double [] read(File file) { … | |
Re: This '%' gives the remainder of a number. An even number is the one that can devided by 2 so the remainder of 2 should be 0: [CODE] if (number%2==0) { System.out.println("Number: "+number + " is even."); } [/CODE] | |
Re: The link can be: [CODE] <a href="somepage.jsp?param1=aaaaa¶m2=3333¶m3=123">Link 3</a> [/CODE] And at the somepage.jsp, you can do this: [CODE] String a1 = request.getParameter("param1"); // aaaaa String a2 = request.getParameter("param2"); // 3333 String a3 = request.getParameter("param3"); // 123 [/CODE] | |
Re: I don't think you can edit that. It is very difficult to do it and since it is auto generated you shouldn't. Better start over. I prefer not to use the GUI builder because it does not allow to create dynamic gui components (a variable number of buttons during run … | |
Re: [QUOTE=jwenting;1168831]Never read more in the specs than they state. The specs state to output that text to screen, so that's what you write. What the author of the specs intended has nothing to do with that, if they signed off on that document, that's what they get unless they pay … | |
Re: Take a look at your brackets. Always use them. You are suppose first to check the input and then calculate: [CODE] for () { if (not a digit) { return false; } } // if the above code didn't return then the input is OK [/CODE] But you do this: … | |
Re: After looking at the other post with the same question, please [I]eshirley[/I] answer me this. Why didn't you post the code you posted here to that thread. In general why didn't post the entire first post of this thread to that. It would have been acceptable. You asked for a … |
The End.