32,204 Topics

Member Avatar for
Member Avatar for anuran

iam building a training set for spam filtering using java,training set data is given as words in text files in one folder,but im unable to debug whats going wrong in java collections [CODE]/* *folder part 1 conatins various text files having name format * **spmsg***.txt and ***legit***.txt e.g 11927legit569.txt ,106127spmsgc26 …

Member Avatar for anuran
0
171
Member Avatar for neemo6

Well I just got a new latop with windows 7 and downloaded textpad 5 to do my java homework. At first I had issues just trying to compile but then found out that i needed to point textpad to javac.exe for it to compile. Now my problem is i cant …

Member Avatar for Taywin
0
216
Member Avatar for logicmonster

I have to calculate the number of days between two dates the hard way. I know there is already a way to do this with an existing package and such but I have to do it within a single method "daysBetween" without altering any other part of the code. The …

Member Avatar for logicmonster
0
981
Member Avatar for twistedspoon

I'm having trouble understanding the binarySearch method in the Arrays class when using an Object array. Is it possible to use this method to search for a specific field within an object in an object array? For example, if my Object array is an array of Person objects, each with …

Member Avatar for Ezzaral
0
122
Member Avatar for crazins

Hi im trying to make a program that passes an array to a method. the method then finds the smallest number in the array and passes that number back to the main where its printed out. I am getting an error saying: "error: number cannot be resolved to a variable". …

Member Avatar for crazins
0
110
Member Avatar for willywhomperz

I am trying to get this to work and am stuck. I run a JUnit test and get a few failures. Can someone show me the way to make this work? [CODE] /** * int numberOf(String s, String characters) * * Returns the number of times any of the chars …

Member Avatar for Ezzaral
0
171
Member Avatar for NexG

Not asking for code, but I'm wondering if anyone can give me some advice and pointers for writing a code that reverses an inputted int, without using the string reverse.

Member Avatar for NexG
0
182
Member Avatar for anuj_sharma

Hi, I am getting an error "Illegal Start of Expression" on the following code: [CODE] obj.NoOfJumps(1, 2, 3, {1,2,3}); [/CODE] Here, NoOfJumps is a method defined in a class which does not have the main method. This method accepts 4 arguments namely 1)Integer 2)Integer 3)Integer 4)Integer Array Can someone please …

Member Avatar for Ezzaral
0
146
Member Avatar for anonymousi

Hi! I am thinking of starting a program for a java enabled phones or smartphones... I am a beginner there for i don't have advanced knowledge of such programming... So heres my requirements; 1.the code should be able to run in netbeans 2.step by step process with explaination for understanding …

Member Avatar for anonymousi
0
272
Member Avatar for BobTheLob

I'm working on a quicksort class, but I'm required to get the pivot multiple ways (last value, median of 3, and median of 5). Getting the median of 3 is easy enough with a few if statements, but I'm having trouble figuring out how to get a median of 5 …

Member Avatar for JamesCherrill
0
130
Member Avatar for laitingfei

So I've made a game called HangMan, but it still needs the finishing touches. Anyways, a bit about the game... A JFrame shows 26 buttons for the letters of the alphabet and a whole set of other buttons to make up empty slots (they eventually will be filled in everytime …

Member Avatar for Taywin
0
298
Member Avatar for vishal1949

I don't know how to use Notify and wait in my program but I am required to. The point of my program is that there are two threads, one which assigns the inputted object to the numbers 1-10 and another that reads them. Could anyone help. [CODE] package vairables; public …

Member Avatar for Taywin
0
278
Member Avatar for PurpleHeaven

Hello guys I need some help about the Pascal's Triangle. It's not about showing an output of the triangle itself but it's a little different. The user will be asked to choose a row number in the triangle. After that, it will output the sum of all the values above …

Member Avatar for Taywin
0
214
Member Avatar for agmolina90

[B]Problem[/B]: (The Person, Sruden, Employee, Faculty, and Staff classes) Design a class named Person and its two subclasses named Student and Employee. Make Faculty and Staff subclasses of Employee. A person has a name, address, phone number, and email address. A student has a class status (freshman, sophomore, junior, or …

Member Avatar for Taywin
0
601
Member Avatar for zack_falcon

Hi there! I'm an IT student, doing a final project of some sort for my college, a board game called "Game of the Generals" (something similar to Stratego). I've done some work in C# using Visual Studio 2005, but my experience told me C# is a rather poor language to …

0
86
Member Avatar for tawisak

[CODE]package demo.weatherforecast.main; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import org.xmlpull.v1.XmlSerializer; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.util.Log; import android.util.Xml; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.Toast; public class EditCity extends Activity { String xmlFilepath …

0
54
Member Avatar for hfx642

I've created a component (a replication of a JSpinner) with a JTextfield, and two JButtons. I've created ActionListeners on each of the JButtons to update the JTextfield. In my main program, I've create new objects based on my new component. I've added ActionListeners on my new objects.JButtons. My new ActionListeners …

Member Avatar for JamesCherrill
1
653
Member Avatar for suresh.yemineni

Using the code for JMS client and did the same as mentioned in the http://www.java2s.com/Code/Java/J2EE/ThisexampleisasimpleJMSclientapplication.htm and run time exception occured exception is : Exception occurred : com.sun.messaging.jms.JMSException: [C4003]: Error occurred on connection creation [localhost:7676]. - cause: java.net.ConnectException: Connection refused: connect com.sun.messaging.jms.JMSException: [C4003]: Error occurred on connection creation [localhost:7676]. - cause: …

0
54
Member Avatar for Wob

Hi, I'd like to develop an algorithm that would only accept positive real numbers and would loop the input until the input is a real positive number.

Member Avatar for Wob
0
70
Member Avatar for dennysimon

hello all I create a Jpanel ,with TextField For name and password. My question is how to increase My TextField Height,is is veri short ,I need to increase to 300 % of it's now 's height I include partial code below thanks denny [ICODE] JLabel lblnama=new JLabel("NAME"); JLabel lblpassword=new JLabel("PASSWORD"); …

Member Avatar for dennysimon
0
6K
Member Avatar for mohitj786

[CODE]import java.util.Scanner; class M6 //Main Method { public static void main(String args[]) //Index of Largest Number method { int a[]; int i; a= new int[10]; System.out.print("Enter any 10 numbers:"); Scanner s = new Scanner(System.in); a[0]=s.nextInt(); a[1]=s.nextInt(); a[2]=s.nextInt(); a[3]=s.nextInt(); a[4]=s.nextInt(); a[5]=s.nextInt(); a[6]=s.nextInt(); a[7]=s.nextInt(); a[8]=s.nextInt(); a[9]=s.nextInt(); System.out.println("The 10 no.'s you have entered …

Member Avatar for imyself
0
144
Member Avatar for agmolina90

Ok, I have no idea how to use a class I created its probably really simple but I still cant figure it out Person employee = new Employee("Tom Jones", "777 B Street", "408-888-9999", "tj@xyz.com", "Room 221", "$30450", [COLOR="Red"](2, 8, 1987)[/COLOR]); I am trying to use this with this class I …

Member Avatar for agmolina90
0
307
Member Avatar for agmolina90

Ok I am a programming student and need help with a problem, I already have most of it (so I don't need you guys to do my hw :P) but I am having problems with am, and I am not even sure if I am doing it right. [B]Problem:[/B] (The …

Member Avatar for Ezzaral
-1
10K
Member Avatar for autorunman22

im currently programming a simple space invaders.. i have the aliens, missiles and the player.. all of them are working smoothly, but say those aliens are landed into the earth, when missiles hit the stones (for example) the stone must hava a damage. like in "GUN-BOUND" by mobius. can anyone …

Member Avatar for Ezzaral
0
98
Member Avatar for denvious

Hello All, I'm currently having an issue trying to retrieve elements that have been saved within my arraylist. I currently have two classes, Project and Staff. In the Project class, i have declared an ArrayList of type [i]staff[/i], as seen below: [CODE]public static ArrayList<Staff> staff = new ArrayList<Staff>();[/CODE] In the …

Member Avatar for denvious
0
9K
Member Avatar for harsimran05

i have taken two fields date of issue and date of maturity like this [CODE]try { tDateofIssue=new JFormattedTextField(new MaskFormatter("##-##-####")); tDateofIssue.setBounds(200,130,125,30); c.add(tDateofIssue); } catch (Exception ex) { ex.printStackTrace(); } try { tDateofMaturity=new JFormattedTextField(new MaskFormatter("##-##-####")); tDateofMaturity.setBounds(200,400,125,30); c.add(tDateofMaturity); tDateofMaturity.addFocusListener(this); } catch (Exception ex) { ex.printStackTrace(); }[/CODE] and taken both the field of date/time …

Member Avatar for JeoSaurus
0
95
Member Avatar for eddieteddie

Hi everyone... I feel like this is the end of everything....I cannot do this java, I have reviewed the lecture slides again and again and I still cannot do it....Yes I know I am stupid but I really do need help.... This is my assignment, and it is simple (For …

Member Avatar for NormR1
0
189
Member Avatar for gedas

hi guy, i am trying to create a text wrapping method soemthing like this [CODE] public void textwrap( String text, int width){ } [/CODE] what i need it to do is to print the text in a column of specified width. for example a user set width to 20, what …

Member Avatar for Zaad
0
214
Member Avatar for aldeene

does anyone have any knowledge on serial port communication in java? can someone please direct me?

Member Avatar for frank.montyne
0
79
Member Avatar for jeraldmuthu

This is the code generating xml to feed into Javascript How to convert javascript output of the image to swf format using JAVA.. [CODE] package com.info.chart; //Contributor: i18n : Pedro Casals Fradera (2006/06/22) import java.awt.Color; import java.awt.Font; import java.awt.Paint; import java.io.FileNotFoundException; import java.io.IOException; import java.io.OutputStream; import java.text.NumberFormat; import java.text.SimpleDateFormat; import …

0
87

The End.