1,963 Posted Topics

Member Avatar for bondgirl21

You don't need the StringTokenizer: [CODE] BufferedReader br = new BufferedReader(fr); int numOfVowels = 0; String line = br.readLine(); while (line!=null) { char [] ch = line.toCharArray(); // loop the char array. // for each character in the array, if you find a vowel increase the numOfVowels // always the …

Member Avatar for bondgirl21
0
1K
Member Avatar for tyson.crouch

First of all learn how to read data from the database and proper OOP. When you copy code you must understand what it does. Not use it blindly: [CODE] while(res.next()){ count ++; } res.beforeFirst(); .. [/CODE] Where in your code you use the 'count' variable and what is its purpose? …

Member Avatar for javaAddict
0
99
Member Avatar for SwapnilDD
Member Avatar for aks_1

Did you put that at the url: httt//:localhost:8085//webapp//jsp//index.jsp ? Because it needs to be: httt//:localhost:8085/webapp/jsp/index.jsp Provided that the index.jsp file is at the right location.

Member Avatar for aks_1
0
145
Member Avatar for KatWoman27

Write a for loop from 1 to 36000. Check the Random class and use the method return a random number twicwe in the loop. Once for the fist die and second for the second die.

Member Avatar for javaAddict
-1
381
Member Avatar for ihong154

The error is pretty clear: [QUOTE] Cannot invoke compareToIgnoreCase(int) on the primitive type int [/QUOTE] String is an object, so it has methods that you can call, like: compareToIgnoreCase. But ints, as well as doubles, ... , are primitive types and don't have methods to call. Why don't you use …

Member Avatar for javaAddict
0
149
Member Avatar for JAK3CAL

Learn to use code tags. click the CODE button, when making a post. Always do this: double[] array = new double[201]; for (int i = 0; **i < array.length**; i++){ when you print the array values, do you get what you wanted? Is the total sum correct? The code looks …

Member Avatar for javaAddict
0
110
Member Avatar for stain3d

Line 25: [ICODE]System.out.println(object5.mName());[/ICODE], I doubt that the Month class has a method mName() . What errors do you get and what are you trying to do?

Member Avatar for moutanna
0
3K
Member Avatar for InsaneOstrich

[QUOTE] java.lang.NullPointerException at javax.swing.plaf.basic.BasicListUI.updateLayoutState(Unknown Source) at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(Unknown Source) at javax.swing.plaf.basic.BasicListUI.getCellBounds(Unknown Source) at javax.swing.JList.getCellBounds(Unknown Source) at javax.swing.JList.ensureIndexIsVisible(Unknown Source) at sun.swing.FilePane.ensureIndexIsVisible(Unknown Source) at sun.swing.FilePane.doDirectoryChanged(Unknown Source) at sun.swing.FilePane.propertyChange(Unknown Source) at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source) at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source) at java.awt.Component.firePropertyChange(Unknown Source) at javax.swing.JFileChooser.setCurrentDirectory(Unknown Source) at javax.swing.JFileChooser.setSelectedFile(Unknown Source) [B]at GalleryPanelTest.testGalleryPanel(GalleryPanelTest.java:35)[/B] [/QUOTE] At line 35 of the file: …

Member Avatar for InsaneOstrich
0
555
Member Avatar for p_jain

What do you do when you login? Do you put the username into the session?

Member Avatar for javaAddict
-1
62
Member Avatar for iZander

You need to add an actionListener to the button, so when it is clicked a method would be called. Look at the API for the Button and for ActionListener. Also try to use the swing package: javax.swing.* And the classes: JFrame, JButton, .... Also it is good to read some …

Member Avatar for javaAddict
0
95
Member Avatar for oggiemc

The rs is of type ResultSet, the "" is type String. Why do you think that this : [ICODE]rs.equals("")[/ICODE] will work, since you are comparing a ResultSet object with a String object. If the query returns no data, then the first call to the rs.next() will return false. Also it …

Member Avatar for javaAddict
0
106
Member Avatar for jordanhagen

Have you written any code? Look at your requirements: -Load the data into from a file into an array of address book So create an AddressBook class. Personaly I don't like the name of the class given by the assignent, because an AddressBook has many entries, but assume fot the …

Member Avatar for javaAddict
0
1K
Member Avatar for padmaanand

Not to mention that you didn't even need to pass it as parameter because you already had it: [CODE] class ArrayGet { [B]int[] a = new int[20];[/B] .. } [/CODE] In the same way you call the Display() with no arguments and it takes the correct global array a[], the …

Member Avatar for javaAddict
0
144
Member Avatar for ninadg

You are missing something basic in Java which is why you should leave JSP and practice more: [CODE] if (myvar.equals("compareme")) out.println("string matches"); else out.println("string MISMATCH"); [/CODE]

Member Avatar for javaAddict
0
372
Member Avatar for john2342

If you don't know that the first method is the constructor and that it creates an array of bytes, then there is no point in continuing explaining when all you need to do is some studying on your own. The code does what it does. It has for-loops, while-loops and …

Member Avatar for javaAddict
0
80
Member Avatar for Ghada Ibrahim

When A.jsp first loads the V is null. So you can do this: [CODE] <% String V = request.getParamater("V"); if (V==null) { %> <form onsubmit="return validateSelect()"action="Select.jsp" method="get"> <h2>Select:</h2> <h3>Enter the URL of the publisher you perfer to publish your ads on: </h3> <br/> <input type="text" name="SUrl" style="width: 250px;" /> <input …

Member Avatar for Ghada Ibrahim
0
2K
Member Avatar for sweetgurl
Member Avatar for sam8

count1 is non static. It is an attribute of the MergeSort1 class and must be called the way the non static methods are called: [CODE] MergeSort1 marr = new MergeSort1(maxSize); System.out.println("Number of comparisons: " + marr.count1 ); [/CODE] When you are inside the class MergeSort1 you are ok, because it …

Member Avatar for sam8
0
3K
Member Avatar for sweetgurl

[QUOTE=masijade;1197405]Your method is returning a single double, rather than a double array, and you index into an array, not a double.[/QUOTE] Look at [I]masijade[/I]'s post. And you made the same mistake to another of your posts.

Member Avatar for sweetgurl
0
131
Member Avatar for sennat_26

I would suggest to remove the final and make it private. Then add a public method that returns its value. [CODE] private static String EXIT=ButtonConstant.getString("BUTTON_CONTENT"); public static String getEXIT() { return EXIT; } [/CODE] With that way the value changes, but no one can change it programmatically If this doesn't …

Member Avatar for javaAddict
0
147
Member Avatar for ubi_ct83

[QUOTE=ubi_ct83;1197385]yup. i got it!! 1) To get d item from dorpdown menu: String tvalue_str=(String)t2.getSelectedItem(); 2) this is d way i write to display the selected item : int3.append("Value of T ="+tvalue_str+"\n"); thanks sennat_26[/QUOTE] I would like to add that in the same way you added String to the JComboBox, you …

Member Avatar for javaAddict
0
64
Member Avatar for bubba-bo
Member Avatar for indu_ss4

I don't know anything about jsf, but can you make it so it won't be session scope? If you had already thought of that, then sorry, but that's all I can think of.

Member Avatar for indu_ss4
0
1K
Member Avatar for Mandana_bgh

You need to set the appender of the logger: log4j.properties file: [CODE] log4j.logger.log_name=debug, F log4j.appender.F=org.apache.log4j.DailyRollingFileAppender log4j.appender.F.File=full_file_path/file.log log4j.appender.F.DatePattern='.'yyyy-MM-dd [/CODE] Every day the old file will be renamed according to the pattern, Look at the API for the class: org.apache.log4j.DailyRollingFileAppender and for the Logger class.

Member Avatar for Mandana_bgh
0
100
Member Avatar for vitroblue

First of all study some html. The "select" tag misses the "option" tag which is the one that has the "value" attribute. If you look at the tag, you don't give it any value. So of course it displays null since you don't send anything. [URL="http://www.w3schools.com/default.asp"]http://www.w3schools.com/default.asp[/URL] Second don't just call …

Member Avatar for javaAddict
0
160
Member Avatar for ttboy04

First of all the this.pig is null. You declare it as attribute at the class but you never give it value. You need to pass the parameter of the constructor to it: [CODE] public Amplifier(Pig aPig) { this.pig = aPig; this.number.resetCount = 0; } [/CODE] Also in the reset method …

Member Avatar for ttboy04
0
270
Member Avatar for senormateo2011

I haven't looked at the code but only this part: [CODE] pictures = reader.nextInt(); ... title1 = reader.nextLine(); [/CODE] This is why I never use the nextInt methods and I prefer this: [CODE] pictures = Integer.parseInt(reader.nextLine()); ... title1 = reader.nextLine(); [/CODE] So here is what happens because it has been …

Member Avatar for biedi
0
294
Member Avatar for bahr_alhalak
Re: help

I can't understand the second question. For the first: [CODE] Date date = new Date(); // or Calendar cal = Calendar.getInstance(); [/CODE] Look at their APIs. [URL="http://java.sun.com/j2se/1.5.0/docs/api/java/util/package-summary.html"]http://java.sun.com/j2se/1.5.0/docs/api/java/util/package-summary.html[/URL]

Member Avatar for bahr_alhalak
0
112
Member Avatar for Usmaan

Each class must the other as global attribute. When a button is clicked call setVisible(false) method of the one you want to hide and setvisible(true) of the one you want to show. The above methods are methods of the JFrame class. You can also have the constructors so they can …

Member Avatar for Usmaan
0
90
Member Avatar for adity

If you look at the API of the Vector class you will see that there is a method that lets you add an element at a specific place. I think it is like this: [CODE] add(int i, Object obj); [/CODE] Look at it, but if I remember correctly, it adds …

Member Avatar for javaAddict
0
183
Member Avatar for pirateninja1111

Use a while loop: [CODE] while (true) { .... } [/CODE] Keep reading input from the keyboard. When, for example, you enter "quit", exit from the loop using the "break" command. Else convert that input into a number and add it to the list. [CODE] String input; while (true) { …

Member Avatar for jwenting
0
89
Member Avatar for saggykulji

what errors do you get after running the code? The toString method seems fine. If it doesn't work, then maybe the problem is in the way you put data at the queArray and the way you define the front, rear

Member Avatar for javaAddict
0
601
Member Avatar for bigbags911

In the main you create 2 instances of the class: TicTacToeGame. Shouldn't you be creating TicTacToeplayer instances?

Member Avatar for javaAddict
0
76
Member Avatar for BobbieJean

You need to post the line that you get the error. The error messages, indicates the line that it happened as well as the file.

Member Avatar for javaAddict
0
183
Member Avatar for beanboy

Print the query that you are executing: [CODE] String query = "....."; [COLOR="Green"]System.out.println(query);[/COLOR] i1=st1.executeUpdate(query); [COLOR="Green"]System.out.println(i1);[/COLOR] [/CODE] What does it print? Also try to take the query that was printed and run it to an sql command promt.

Member Avatar for beanboy
0
192
Member Avatar for KurtDOg200

Post your whole code. And this: [B]<%=employeeIDArray[i]%>[/B] suppose to be put in the "html" code. Not in the scriplet

Member Avatar for javaAddict
0
72
Member Avatar for Tabone3

What kind of data, you want to save and do you have any "homework" restrictions concerning how the data will be saved? There is the easy way using the Serializable interface. The code is only a few lines, but you will not learn much. And the hard way would be …

Member Avatar for Tabone3
0
186
Member Avatar for chihwei

Is is against the forum rules to spam; and any other forum. When you have nothing useful to add or post new information dont post at all. [I]ProgrammersTalk[/I]'s post which was quoted in [I]peter_budo[/I]'s reply was such: [QUOTE] that's just the same thing haha.. [/QUOTE] What did it contribute to …

Member Avatar for peter_budo
0
200
Member Avatar for cool_jatish
Member Avatar for ttboy04

Inside the overridden method use code that checks the color. If it is purple, don't change it

Member Avatar for ttboy04
0
93
Member Avatar for DemarioBolden

Look at the API of the Scanner class. Use the methods hasNextInt and nextInt. Read the numbers and use a for-loop for each line, in the while loop. The numbers will tell you how many asterisk you will print. Also read the assignment for that matter. Surely you know how …

Member Avatar for javaAddict
-1
109
Member Avatar for sinister747

Assuming that you are using java 1.5 or later then: [CODE] public class SomeObject implements Comparable<SomeObject> { public boolean equals(Object obj) { if (obj==null) return false; if (obj instanceof SomeObject) { SomeObject so = (SomeObject)obj; // write your code here that compares the values of the so attributes with the …

Member Avatar for sinister747
0
106
Member Avatar for isaac4luck

You need to provise more information. How was the jar file created, how do you run it, and do you get any error messages?

Member Avatar for jwenting
0
167
Member Avatar for teen-omar

Since you start the index from 0 the first loop would be this: [CODE] for (int i = 0; i < sides; i++) [/CODE] If sides = 3, then i = 0,1,2. 3 sides. Or: [CODE] for (int i = 1; i <= sides; i++) [/CODE] If sides = 3, …

Member Avatar for teen-omar
0
281
Member Avatar for anjal_pawar

In this thread you ask the same question: [URL="http://www.daniweb.com/forums/thread274702.html"]http://www.daniweb.com/forums/thread274702.html[/URL] An answer has been given to your question. Don't go around making new threads with the same question. NO one is going to write the code for you no matter how many thread you start. You have been given suggestions; now …

Member Avatar for javaAddict
0
124
Member Avatar for scratchwiz

Actually you need to convert String to int. If this: [B]emarks_txt[/B] is a JTextFiled then this: [ICODE]emarks_txt.getText()[/ICODE] returns String. But your Enrollment constructor takes as argument an int: Enrollment(String student_id,String subject_code,String Grade, [B]int [/B][B]Marks[/B]) So you can do this: [CODE] int Marks = Integer.parseInt(emarks_txt.getText()); Enrollment e = new Enrollment(eid_txt.getText(),ecode_txt.getText(),egrade_txt.getText() , …

Member Avatar for scratchwiz
0
147
Member Avatar for xsach

First of all don't use the list() method because it doesn't return the full path and you forced to do this: String NewDir = dirLocation +"\\"+filename; Try this: public void method(File dir) { File [] children = dir.listFiles(); for (int i=0;i<children.length;i++) { if (children[i].isFile()) { BufferedReader reader = null; try …

Member Avatar for xsach
0
114
Member Avatar for pateldeep454

Call all the methods in the main like you are doing and after each call, print the instance. This: [ICODE]System.out.println (x);[/ICODE] will not work because: When you call the System.out.println with an object as argument, the toString method of that object is called. Since you haven't defined such method, the …

Member Avatar for harry010
0
645
Member Avatar for KSUliz

Have you tried reading the errors that you get? Because If you had the solution would be very easy: [QUOTE] Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at Transfer.actionPerformed(Transfer.java:111) [/QUOTE] You get a NullPointerException at the Transfer.java file, at the actionPerformed method at line 111. You are using something which is null. …

Member Avatar for KSUliz
0
134

The End.