1,963 Posted Topics
Re: [QUOTE=clickranju;681951]Thanks ..i thought JSP is a server side scripting language using in web development..Am i right..? My question is which will be more efficient and useful for this project...[/QUOTE] Actually .jsp files have html "code" inside them (the proper term is html tags). But with JSPs you can add java … | |
Re: As you say in one of you other posts, if you are new and don't know how to make code, start by writing simpler codes | |
Re: Try to write a class that saves the objects you create (namely the Inventory instance that has all the DVDs and movies) to a file. Yo could use the classes: FileInputStream ObjectInputStream FileOutputStream ObjectOutputStream You objects must also implement the Serializable interface to do that | |
Re: From a tutorial I have: For example, to create a cookie named userID with a value a1234, you would use the following. Cookie c = new Cookie("userID", "a1234"); If you create a cookie and send it to the browser, by default it is a session-level cookie: a cookie that is … | |
Re: And the getPages(), getTitle(), methods are not declared in the Book class. That is why you get error. They are defined in the Chapter class so you should do: [CODE] public void printContents() { System.out.println("Contents:"); System.out.println("1." +first.getTitle()"........." +first.getPages()); System.out.println(""); System.out.println("2." +second.getTitle()"...........:" +second.getPages()"\n"); System.out.println(""); System.out.println("3."+third.getTitle()"...........:" +third.getPages()"\n"); System.out.println(""); } [/CODE] | |
Re: Create in a separate class methods for connecting writing and reading to the database. Then replace the code where you write to the file with the methods from the class | |
Re: Probably because the file does not exist. And you could use BufferedReader for reading from file. | |
Re: You will instantiate a class the extends from InputStream. The class will have implementation of the abstract methods. | |
Re: Please post the errors you get and at which line you get them | |
Re: [CODE] for (int i=0;i<personList.size();i++) { String s = personList.get(i); } [/CODE] | |
| |
Re: If what you said made sense, the answer is NO. Html is a tagged based "language" used to create web pages. Javascript (has nothing to do with java) is executed in your browser (to be exact is executed at the client but I don't know how else to explain it … | |
Re: You can use the Locale to parse a certain Date object: [URL="http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html"]SimpleDateFormat.html[/URL] And use the constructor with the Locale as argument. [CODE]SimpleDateFormat(/*String pattern*/ "dd/MM/yyyy", Locale.ENGLISH) [/CODE] But I don't think that what you are asking is possible. | |
Re: [CODE] double a = Math.exp(b); //e^b double c = Math.pow(a,b); //a^b [/CODE] Go to this link: [URL="http://java.sun.com/javase/6/docs/api/java/lang/Math.html"]Math[/URL] | |
Re: I trust that you already have created the class: Staff. It should be like what sciwizeh has suggested. This is an example on how to read from the keyboard: [CODE] Staff [] staff = Staff[12] //this is an ARRAY. It is not null, but these are: staff[0], staff[1], ... BufferedReader … | |
Re: [QUOTE=jOhN_pRattZ;674319]hello im john rico a com sci student could anyone help me to make a program that has three equation and three unknown pls.[/QUOTE] You can either use Gauss as sciwizeh has suggested, but if don't know the algorithm you can do it the old fashion way, by solving this … | |
Re: I would suggest to look at this class: [URL="http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/Logger.html"]Logger[/URL] And search tutorials or examples, since you are interesting in log files | |
Re: There is a null personList of type List, but you declare that the null personList List will have ONLY elements of type Person. The personList maybe null, it is type List but you put "things" in the List. And you declare that when you are going to put things in … | |
Re: You did a whole year of programming and no one taught you the simple algorithm for looping and finding the max number? | |
Re: What do you want getInvoice() to return? Are you sure you have posted all the code of the Invoice class? It seems to me that the Invoice variable inside getInvoice() doesn't have a value, but I will need the rest of the code to be sure | |
Re: The code will be the same. It doesn't matter for what you are going to use it. I will post the code soon, after I finish some other issues I have. | |
Re: You haven't done this: btnref.addActionListener(this); And why do you do this: txtamt1.setText(null) instead of this: txtamt1.setText( "" ) | |
Re: [CODE] package testpackage; /** * * @author stamatios.bardanis */ public class Person { private String name=null; public Person() { name=""; } public Person(String na) { name = na; } public String getName() { return name; } public void setName(String na) { name = na; } public String toString() { return … | |
Re: Fist of all, as a concept do you know what stack is? Do you know what this calculates to: + a b? Stack is a structure where you put items in it one after the other and when you want to remove one you take the last one entered (LIFO). … | |
Re: Read the file line by line. When the line you have read is equals to: START_IMAGE, then the next lines will be the image. Then when the line read becomes equals to: END_IMAGE then exit the while loop that you had for reading the file: [CODE] String line = readLine(); … | |
Re: First of all, this: int[] letterCount = new int[26] ; does not throw an exception. Second: Let me guess your program does not compile. This is why: [CODE] try { int[] letterCount = new int[26]; } catch (ArrayIndexOutOfBoundsException e) { System.err.println("Caught ArrayIndexOutOfBoundsException: "+ e.getMessage()); e.printStackTrace(); } [/CODE] You declare letterCount … | |
Re: The int numberValue = Integer.parseInt(number) ; does not throw a IOException. You are right to use it in the catch since readLine() does throw the IOException, but the parseInt() throws a NumberFormatException: [CODE=JAVA] /** * @(#)GetUserInput.java * * * @author * @version 1.00 2008/8/2 */ import java.io.*; public class GetUserInput … | |
Re: Since they are interfaces, you can implement more than 1: [CODE] public class MyFrame extends JFrame implements ActionListener, ItemListener { } [/CODE] Don't forget to add the methods that these interfaces have. Also to add the "listeners" to the components you are interested (buttons) | |
Re: [QUOTE=dhanasekar1986;665041]i have to do mini project on online share trading system... if have coding mail me....[/QUOTE] Are serious? Read jwenting's previous post. And even if you started a new thread, why should we send you our code? | |
Re: So not only you want project titles, (an issue that is discussed many times in this forum) but also you want the solution. If I ask for a date with Pamela Anderson, you think that anyone will reply? :icon_smile: | |
Re: It is not very efficient reading from ResultSet while generating the html. Better to have separate class that returns as an array of objects the data you want and then use that data to generate the page. And the class will be responsible of handling the opening and closing of … | |
Re: Probably he wants a menu with a while loop where the user can enter from the keyboard a number and a date several times | |
Re: [QUOTE=ricss_madara;661913]main manu 1 for Addition 2 for Subtraction 3 for Multiplication 4 for Division 5 for Choice not in list[/QUOTE] You have posted the same question to a different thread: [URL="http://www.daniweb.com/forums/post661955.html#post661955"]http://www.daniweb.com/forums/post661955.html#post661955[/URL] When you were asked from sciwizeh to provide more information, why didn't reply, but started a new one? Any … | |
Re: Do you know which part of the code needs to be replaced with JOptionPane? If you don't that probably means that you didn't write it. Tell us what you don't understand and we will help, but no one is going to email you the solution | |
Re: Do you know that the array will already have the values sorted? From what I see: double[] priceArray = { 21.00, 17.00, 12.00, 10.00, 4.90, 4.90, 1.80, 1.80 } ; The array is already sorted, so you just need to take the 2 last values. If this is not the … | |
Re: No you need to have a finally because even if an exception occurs you will still need to close the PrintWriter. The error happens because you declare PrintWriter inside try {....} and in the finally it is out of scope, it cannot be used outside try because this is where … | |
Re: At the line where you get the NullPointerException you are probably trying to use an object that is null and instantiated. See what the message says and you will find which object is that. Then instantiated correctly based on what is the object | |
Re: Math.random() The above returns a random number between 0 and 1 [QUOTE]a pseudorandom double greater than or equal to 0.0 and less than 1.0.[/QUOTE] [URL="http://java.sun.com/javase/6/docs/api/java/lang/Math.html#random()"]Math.random()[/URL] | |
Re: [QUOTE=ricss_madara;656772]investment duration interest rates offered Less then 3 months 5% 3month-11 months 5.5% 1 year-23 months 7.6% 2 years and above 7.9% Note: Interest = Total investment *Interest rates *Duration Q: How to write a java application to compute the total accumulated investment after the investment periods?[/QUOTE] The inputs of … | |
Re: If you have solved a problem and you run it and it works then don't post it. Post only those that you are having problems with. | |
Re: Two arrays length 10. In one you will put the squares and at the other the cubes. Use a for loop from 0 to 10. Calculate inside the loop theresults and put them in the array: [CODE] square[i] = i*i; cube[i] = i*i*i; [/CODE] | |
Re: [QUOTE=bmbvm5;553492]hello, I am beginner in java . I have very difficult assignment so I need some one guide and help me. can you help me . with best regards[/QUOTE] Then create a new post and state what you cannot understand and what is your problem | |
Re: In a separate class write a method that takes two arguments (username, password). That method should query the database using these two arguments, in order to check if there is such record. If the above combination (username, password) exists then the method should return true, otherwise false. Then create a … | |
Re: [QUOTE]Create a method to calculate the value of the entire inventory.[/QUOTE] It is the classic algorithm: sum += sum+VALUE[i]. Write a method the takes as argument the array of DVDs and inside a for loop calculate the sum. As VALUE[i] you should use: dvd[i].value() [QUOTE]Create another method to sort the … | |
Re: This is a java forum not a javascript forum | |
Re: And what is your question? From a first look it seams that the program works OK. Are you having any problems or the results you receive are not correct? I would suggest adding some checks for the inputs: [CODE] if (args.length<10) { System.out.println("Not enough arguments"); System.exit(1); } [/CODE] or code … | |
Re: I think there is something called: "instance of". I don't remember by heart how to use so might want to search it, but I do know that it works almost like this: [CODE] Rectangle r = new Rectangle(); if ( r instance of Rectangle ) { } [/CODE] But you'd … |
The End.