1,963 Posted Topics

Member Avatar for ninjaelves

You are calling the "equals" method and in your class you have created a "eqls" method. Your class need to override the "equals" method: [URL="http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)"]http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)[/URL] Since you haven't overridden the equals method in your class, in the main, the equals of the super class is called (Object class) that checks …

Member Avatar for javaAddict
0
133
Member Avatar for Ishaniwp
Member Avatar for ttchiwandire
Member Avatar for ramjeev

If you run this code you will see that '==' doesn't work: [CODE] public static void main(String [] args) { String s1 = new String("aa"); String s2 = new String("aa"); System.out.println(s1==s2); // false System.out.println(s1.equals(s2)); // true } [/CODE] The '==' checks if they are the same object and the equals …

Member Avatar for ramjeev
0
95
Member Avatar for 9944574568
Re: HI

What kind of stored procedure. Do you know how to call that procedure from an sql editor? I would suggest to use PreparedStatements or better: [URL="http://java.sun.com/j2se/1.4.2/docs/api/java/sql/CallableStatement.html"]CallableStatement[/URL]. For more info show what you have done so far.

Member Avatar for javaAddict
0
65
Member Avatar for reddy5081

[QUOTE=9944574568;1045038]can u please help me..please send me the code for that how to update the table using stored procedure in jsp program ..need it urgent[/QUOTE] Start a new thread

Member Avatar for javaAddict
0
171
Member Avatar for aj.wh.ca

Whenever you do this: [CODE]return new BufferedReader(new InputStreamReader(System.in)).readLine();[/CODE] you keep creating a new BufferedReader every time you call the method. Not very efficient. Try and have the BufferedReader as static and then use it form the static methods.

Member Avatar for javaAddict
0
239
Member Avatar for redmaverick

If you are worrying why they are not printed orderly then they are not suppose to. They are threads and they are executed in parallel. So this output shouldn't be wrong: [CODE] 10 8 6 9 4 7 2 5 3 1 [/CODE]

Member Avatar for goon
0
204
Member Avatar for _dragonwolf_

What java version are you using? If you are using 1.5 for example then you can map the letters with the morse code using a hashmap: [CODE] HashMap<Character,String> map = HashMap<Character,String>(26); map.put('a', ".-"); map.put('b', "-..."); ... String text = words.getText().toLowerCase(); char[] stringArray = text.toCharArray(); [/CODE] Then you can loop through …

Member Avatar for _dragonwolf_
0
243
Member Avatar for pandeyprashant

If you put it in the session it shouldn't got away. You probably put it in the request, so better show some code.

Member Avatar for javaAddict
0
3K
Member Avatar for hanzooi

Here is how: 1) Post to correct forum 2) Be more descriptive on your problem 3) Show some effort If you are talking about a web application 4) Learn about request, session 5) Learn about cookies 6) Learn about MVC (find the tutorial at the jsp forum) Do you have …

Member Avatar for javaAddict
0
129
Member Avatar for roshnal

[QUOTE=sitienei;1036000]DUNGEON ADVENTURE [/QUOTE] Thanks for the idea. I have been wanting to create a game similar to this for fun, just to kill time, but couldn't get any smart ideas. I will definitely build this and give it to my friends to play.

Member Avatar for javaAddict
0
230
Member Avatar for LKH

[QUOTE=firstPerson;1005679]1) Create a array, which represents a table. 2) use a for loop; [code] for(int i = 1; i != 5; i++) myArrayTable[i] = 6*i; //say, myArrayTable is already declared. [/code][/QUOTE] I have a question: Why didn't you use this at the for loop: [CODE] for(int i = 1; i …

Member Avatar for eggmatters
-3
192
Member Avatar for asong

What is the range of the random numbers? Because you can use the Math.random. Check the API

Member Avatar for javaAddict
0
111
Member Avatar for feoperro

I can't see a problem with your page. Does the page submits? Does it go from page A to page B? Is the name of the Test.jsp correct and are the pages in the same folder? Does onChange works? Should it be onchange? Also you can try this: [ICODE]document.testForm.submit();[/ICODE]

Member Avatar for javaAddict
0
142
Member Avatar for tom.t

At the validation I believe that the seconds should until 59. For the hours you 23, 59. Why not the same for seconds. For the extract when you multiply and then do a mod, you will get 0. 123 * 100 = 12300 12300 mod 100 = 0 12300/100 = …

Member Avatar for tom.t
0
193
Member Avatar for alsoumhi

[QUOTE=alsoumhi;1035263]I want to prevent unathorized users to access directly using URL in my application [/QUOTE] When the user logs in, do you put that user in the session? [CODE] String username; String password; // check the database to see if the user is valid. if (yes) { request.getSession().setAttribute("USER",username); } [/CODE] …

Member Avatar for javaAddict
0
115
Member Avatar for kulrik

[QUOTE=masterofpuppets;1034752]hi :) for the first problem you could do something like this: [CODE]public class Mymath { public calculateFactor( int a, int b ) { if ( a < b && b % a == 0 ) return true; elif ( a > b && a % b == 0 ) …

Member Avatar for javaAddict
-1
1K
Member Avatar for bmanoman

Well I would use a double matrix: [CODE] String [][] ARRAY = { {"A", "B", ...}, {"B", "C", ...}, {"C", "D", ...}, .... } [/CODE] Then for mapping the letters with the numbers in a quick way: [CODE] HashMap map = new HashMap(26); map.put("A",0); map.put("B",1); ... [/CODE] The key is …

Member Avatar for javaAddict
-1
138
Member Avatar for kellybaz
Member Avatar for amitcs100

Given your description (the lack of description that is), you may use a System.out.println.

Member Avatar for BestJewSinceJC
0
198
Member Avatar for blindkilla

First of all when you have questions such as this, always search the API. [URL="http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpSession.html#isNew()"]http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpSession.html#isNew()[/URL] [URL="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpServletRequest.html#getSession(boolean)"]http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpServletRequest.html#getSession(boolean)[/URL] From the create session method, you see that it doesn't always create a new session. That call is the same as the no argument getSession() . The only difference is when you enter false. …

Member Avatar for peter_budo
0
467
Member Avatar for weblover

We don't know what the "Convertor" does. The code seems OK, are you sure the loop doesn't stop? Try printing the data you get from the ResultSet and compare them with what data you have in the database. Also I would suggest to close the Statements: stm, stm1 as well

Member Avatar for weblover
0
170
Member Avatar for Q8iEnG

First of all check the Scanner API. You found a code and you didn't think to check the API. Now, there is the nextLine method that reads the next line of the file. Combine it with the has.. methods to read the entire file: [CODE] while (scanner.hasNextLine() ) { String …

Member Avatar for Q8iEnG
0
195
Member Avatar for obelisk

[QUOTE=shobana_soma;1032930]------------------------------------------------------------------------------------------------MY CODE------------------------------------------------------------------------------------------------------------------------------------------------------- <%@ page import="java.sql.*" %> <%@ page import="java.io.*" %> <html> <head><title>JSP Page</title></head> <body> <% String school = request.getParameter("name"); String name = request.getParameter("username"); String email = request.getParameter("txtEmail"); String pass1 = request.getParameter("pass1"); String pass2 = request.getParameter("pass2"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:shobana", "SYSTEM", "nagalakshmi"); Statement st = con.createStatement(); String sql = ("INSERT INTO register …

Member Avatar for javaAddict
1
1K
Member Avatar for M.Jama

First of all you don't need to have 2 Scanner classes. One would be enough and you can call its methods as many times as you like in order to read as much input as you want. And to [I][B]VernonDozier[/B][/I], the thread is this: [url]http://www.daniweb.com/forums/thread234373.html[/url] Check posts numbers 16, 17. …

Member Avatar for javaAddict
-1
63
Member Avatar for Java-newb

At what line you get the error and what does it say and at which class? You probably haven't defined the actionPerformed method.

Member Avatar for javaAddict
0
138
Member Avatar for M.Jama

[CODE] public class feetInches { public static void main(String [] args) { int feet = 5; int feetToInches = 12; int inches = feet * feetToInches ; System.out.println(feet + " feet is " + inches); } } [/CODE] If you want the user to enter input then search this forum …

Member Avatar for javaAddict
0
1K
Member Avatar for Golam Kausher

Don't loop like this: [CODE] for(int row=0; row<5; row++){ for(int col=0; col<3; col++){ [/CODE] [U]Always[/U] like this: [CODE] for(int row=0; row<array.length; row++){ for(int col=0; col<array[row].length; col++){ [/CODE]

Member Avatar for javaAddict
0
118
Member Avatar for chuppy

Read the comments [CODE] int m [] = { 3, 2, 5, 2 }; int k = 0; // k has value 0 so it returns 3. THEN k is increased because the ++ is after the variable System.out.println("(a)" + m[ k++ ]; // k has now value 1 // …

Member Avatar for javaAddict
0
89
Member Avatar for mohammad007

If you search the net with: "ActionListener" you will receive plenty of examples: [URL="http://java.sun.com/docs/books/tutorial/uiswing/events/actionlistener.html"]http://java.sun.com/docs/books/tutorial/uiswing/events/actionlistener.html[/URL] I took an example from that page and modified it to be more simple for you: [CODE] import javax.swing.*; import java.awt.event.*; public class AL extends JFrame implements [B][COLOR="Red"]ActionListener[/COLOR][/B] { JTextField text = new JTextField(20); [B][COLOR="Green"]JButton b …

Member Avatar for javaAddict
0
100
Member Avatar for vladacmba

That is done by DHTML. There are examples in the web. Just search using: "html tabs menu"

Member Avatar for javaAddict
0
101
Member Avatar for whiteyoh
Member Avatar for whiteyoh
0
119
Member Avatar for whiteyoh

I think you need to remove the '0' from the first number: [CODE] personalList[0] = new Personal("Paul "," White ", [B][COLOR="Red"]0[/COLOR][/B]74078L , "51 Princes Street", "North Shields", "Tyne and Wear", 7852384379L); [/CODE]

Member Avatar for whiteyoh
0
105
Member Avatar for calcucool

[QUOTE=calcucool;1031162] i need to write a data validation method in which if the user enter a blank name(ex. " "), it prints an error message. if the data entered is valid (ex. "Austin"), it returns the value null. [/QUOTE] You just said the solution: The method will have as argument …

Member Avatar for javaAddict
0
106
Member Avatar for shroomiin

First write a method that calculates the n!. Then use a for loop. How many times you will iterate it's up to you. At the for loop you will use the classic algorithm for calculating sums. Declare a sum variable and add to it the result you get from inside …

Member Avatar for javaAddict
0
104
Member Avatar for Java-newb

Please post again the code but this time, the code tags end like this: (/CODE) not: (CODE) Also have each class in its own code tags. Use the (code) button when you create a post

Member Avatar for Java-newb
0
175
Member Avatar for Mareshal

[QUOTE=Mareshal;1029979]Why you people don't understand? IS JUST A SIMPLE BET WITH MY TEACHER. If I can modify his java text editor somehow, anything, a simple char, I can get a 10 for that lab. Does it mean I cheat if I prove him I can do something he can't?[/QUOTE] You …

Member Avatar for Mareshal
-1
212
Member Avatar for Maverick

[QUOTE=nura issa;1030488][QUOTE=Maverick;54326]I am finishing up writing an extensive C/C++ program and am in dire need of completing these 4 short JAVA programs. Any help would be appreciated GREATLY! (I missed a few days of lecture and am extremely behind in this class.. :sad: EDIT: actually just helping me with one …

Member Avatar for javaAddict
0
645
Member Avatar for camilia

First of all don't do an: [ICODE]ps.executeUpdate()[/ICODE]. You don't update anything to the database, you do a select. So use the method that returns a ResultSet: [CODE] ResultSet rs = ps.executeQuery(); if (rs.next) { // user found } else { // invalid credentials } [/CODE] Don't forget to close the …

Member Avatar for javaAddict
0
98
Member Avatar for jrosh

Don't use these methods: ye.getYear() They are deprecated. Instead use the [URL="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html"]java.util.Calendar[/URL] And use the [U]get[/U] method [CODE] Calendar rightNow = Calendar.getInstance(); rightNow.get(Calendar.MONTH); [/CODE] This will return the month. Read the static fields of the API

Member Avatar for jrosh
0
228
Member Avatar for system analysis

[QUOTE=system analysis;1029455] A year is a leap year if it is divisible by 4, unless it is also divisible by 100 but not by 400. [/QUOTE] There is your if statement. Use this '%' operator to determine if a number is divisible by another number. It returns what is left …

Member Avatar for javaAddict
0
135
Member Avatar for hello214

Have 3 methods that accept a: `short []` as argument and return the min, the max, and the average. And next time use code tags. Press the button that says (CODE) when you create a new post

Member Avatar for hello214
0
118
Member Avatar for Gman36

The compiler error should be enough to help you fix this. Read it carefully. Focus on the part: "Cannot resolve symbol s1"

Member Avatar for Gman36
0
86
Member Avatar for Golam Kausher

[QUOTE=Golam Kausher;1027211] I'm having Java course and I have to submit the following programs [B]by the coming Wednesday[/B] [/QUOTE] Was the assignment given to you today? If no, then what were you doing all this time? If yes, then you have a very demanding teacher. [QUOTE=Golam Kausher;1027211] Please may you …

Member Avatar for Golam Kausher
0
117
Member Avatar for system analysis

Well the assignment is pretty self explanatory. After you read the triangles apply the Pythagorean theorem. [CODE] int a = // read the angle int b = // read the angle int c = // read the angle // if a*a + b*b is equal to c*c then it is …

Member Avatar for javaAddict
0
97
Member Avatar for ankiwalia

[QUOTE=ankiwalia;1026269] So can anybody please suggest me another method(leaving jsp) to display my data from database on html page[/QUOTE] If you want to display data to html page then you use jsp. Jsp is actually constructed using html tags. So if you don't know html how can you create a …

Member Avatar for javaAddict
0
122
Member Avatar for kaylors
Member Avatar for Ancient Dragon

So from what I understood: The reputation system affects both the rep points as well as the voting points of the specific post, [U]but[/U] The voting system affects [U]only[/U] the voting points? Also is it possible when the user clicks the Up,Down button to display a pop up confirmation dialog? …

Member Avatar for VernonDozier
0
1K
Member Avatar for ahmedshayan

Like I mentioned in this link: [URL="http://www.daniweb.com/forums/thread232042.html"]http://www.daniweb.com/forums/thread232042.html[/URL] The JobTitle method shouldn't be in the Employee class but in the main method

Member Avatar for ahmedshayan
0
238

The End.