32,204 Topics

Member Avatar for
Member Avatar for jackmaverick1

I've made a little game (not really, just a bit of a start), but the collision detection is a little screwy. It works within 2 pixels for the bottom three sides. However, on the top, there is a buffer of about 20 pixels that it counts as part of the …

0
76
Member Avatar for LogicalOutlier

[CODE]public class Grades{ public int scoreTotal; public int numScores; double average; static String file = "randomNumbers.txt"; int lowest; int x; int temp; public static void main(String[] args) throws FileNotFoundException{ int scoreTotal = 0; int numScores = 0; double average = 0; int lowest = -1; int temp = 0; Scanner …

Member Avatar for NormR1
0
191
Member Avatar for LogicalOutlier

"Draw a grid of 20 streets horizontally and 20 streets vertically. Represent the simulated drunkard by a dot, placed in the middle of the grid to start. For 100 times, have the simulated drunkard randomly pick a direction, move one block in the chosen direction, and draw the dot. Use …

Member Avatar for NormR1
0
733
Member Avatar for usmansajid

Hi there guys, I seem to be having a problem with my java code. Scenario; I have an array, this is generated according to the user; entering 200; will give him 200 numbers. These numbers are supposed to be semi sorted. To achieve this i created a random array, then …

Member Avatar for hfx642
0
1K
Member Avatar for person192

Hi daniwebbers, I am a newbie learning java and keep getting a "cannot find symbol" error when I try to compile my program. I've tried searching but I don't really know what search terms I should be using in this case. Can anyone see the problem? [CODE]import javax.swing.*; import java.awt.event.*; …

Member Avatar for peter_budo
0
216
Member Avatar for Majestics

I m trying to pass a 10.10 value to double and it takes 10.1 instead of this? Any solution.

Member Avatar for mKorbel
0
286
Member Avatar for jackbauer24

Here is my code: [CODE]class Catandmouse { public void CatAndMouse() { Animal cat = new Animal(); Animal mouse = new Animal(); int mouseCaught = (int) (Math.random() * 10); cat.CatchMouse(); int catgetsit = 0; if ( mouseCaught == cat.number ) { System.out.println("The cat caught the mouse!"); } else { System.out.println("The mouse …

Member Avatar for jackbauer24
0
84
Member Avatar for umair jameel
Member Avatar for DJSAN10
0
147
Member Avatar for jade_91

well basically i have this code working to display distance to nearest station and the station name but i want it to show what line the station nearest is located on i've tried to figure it out but just dont seem to be getting anywhere with it the code (including …

Member Avatar for DavidKroukamp
0
99
Member Avatar for hust921

Hey everyone, i need a little help with searching a string and putting that date into another string. ex: [CODE] String com = ""; String mystring = "sometext here: !com shutdown"; // Magic happens System.out.println(com); // Output: "shutdown" [/CODE] "!com" is the constant to search for, shutdown is variable.

Member Avatar for hust921
0
132
Member Avatar for Mr.BunyRabit

Hey there. How do i stop this damn computer form automatically filling in my second Qoute when i make the first one " and then i have to press space for there just to appear one. It messes me around sooo badly with my programming. it does that wiht quotes, …

Member Avatar for Mr.BunyRabit
0
682
Member Avatar for Melow

Hy I want to validate expression as such: [code]AO:10 EM:1 IO:102 AO:SA EM:SA,AKA,LLMN[/code] so on... I'm noe to Regex and i came out with the following function: [CODE] public void checkFormat(String line) { String expression = "^[ACEILMNOU.]{2}+\\B[:]{1}+\\w{2,4}+"; Pattern subscriptionExpretion = Pattern.compile(expression, Pattern.CASE_INSENSITIVE); Matcher matcher = subscriptionExpretion.matcher(line); if(matcher.matches()) { System.out.println("matches " …

Member Avatar for Melow
0
191
Member Avatar for tushar_shimpi

i am having problem in developing a project based on bluetooth. i am not able to import the package javax.microedition.lcdui.*.it showing error that package not exits. please tell me what to do...

Member Avatar for peter_budo
0
31
Member Avatar for nesnes

i got this code form the internet where it can delete a file.but when i tried to use it n my own java program it does not work anymore.it always returns 'Could not delete file'. ~this code is for my method delete[CODE]public void delete(String file, String lineToRemove) throws IOException{ try …

Member Avatar for ~s.o.s~
0
800
Member Avatar for iamthesgt

For a (homework) project, I have a class ComplexNumber that needs to be printed. I have a number of operations that can be done on objects of the class (addition, subtraction, multiplication, division). Each operation returns a new ComplexNumber to be printed. How exactly do I print this? Do I …

Member Avatar for iamthesgt
0
160
Member Avatar for skoon

I am new to programming, so please accept my apologies if this question is simple. My teacher wants us to create a method that searches a stack for the name that occurs most often and returns it for example : If I have these names in my stack: Tiger Woods, …

Member Avatar for Philippe.Lahaie
0
101
Member Avatar for DigitalSheriff

Hello to you all! I am relatively new to java but I am creating a project in java using net beans 7.1 where I create a mysql database that holds the data of a web service. Unfortunately, while my code runs fine, it shows at the beginning the following two …

0
46
Member Avatar for BBA07

[CODE] proiect2 package; import java.io. *; public class String { static BufferedReader buffer = new BufferedReader (new InputStreamReader (System.in)); static String string = null; public static void main () throws IOException, NumberFormatException { System.out.println ("Enter string:"); String string = buffer.readLine (); while (sir.length () == 0) { System.out.println ("The string …

Member Avatar for DavidKroukamp
0
403
Member Avatar for jackbauer24
Member Avatar for jackbauer24
0
96
Member Avatar for hbluthi

Hey guys. I am creating an ordered list using an array. Not an ArrayList or anything else. I can not figure out how to get all of the data from the OrderedList constructor to carry through to my "insert" method. Therefore, when I am checking if "count == 0" it …

Member Avatar for Philippe.Lahaie
0
195
Member Avatar for cloud02

Hi, is there anybody here knows how to store arrays in a text file? let's say the user inputs the id, name, and address and stores it on a text file then shows its output.. ex. 245656, John, 6534 Japan, Male. something like that. or anyone have a similar program …

Member Avatar for DavidKroukamp
0
166
Member Avatar for jade_91

Hi, basically ive been trying to write code to work out where the nearest station for a person is based on their current location. I did have it working to display nearest station name and distance from that station but something went wrong I must have accidently deleted something or …

Member Avatar for DavidKroukamp
0
140
Member Avatar for Melow

Hy, I have to write a program witch recognizes the extension of the file it gets as argument after that it has to validate the file line by line. A file should look like this: ex: Name, Age, Email, OptionalField1, OptionalField2 Anna, 22, [email]anna@smting.com[/email], completed Mark, 24, [email]mark@smting.com[/email], completed completed …

Member Avatar for Melow
0
180
Member Avatar for StephNicolaou

Hi all, This is also similar to web browsers which use the codes, &d for date, and &l&f&r for document name, etc. I would like to start the page number for 165, for example, is there a code to do this? (For within the print preview/page setup area). I've already …

Member Avatar for StephNicolaou
0
168
Member Avatar for ThaiAmL

Hello! I'm trying to write a program that will eventually carry out matrix multiplication (by another matrix and by a vector) among a few other methods for a homework assignment. However, the assignment says we first need to write a default constructor that creates the 3x3 Identity Matrix. I'm not …

Member Avatar for DavidKroukamp
0
847
Member Avatar for dreamslct

Hi, I am doing an exercise of Head First Java Pool puzzle. I tried many times and finally got the output required but I am still not fully understand that how program produced that output. The code for Pool Puzzle is as under: [Code] class Echo { int count = …

Member Avatar for dreamslct
1
929
Member Avatar for anand01

Hi all, when I use break statement like following it doesn't show any error [CODE] String o="": o = o + 2; z: for(int x = 3; x < 8; x++) { if(x==4) break; if(x==6) break z; o = o + x; [/CODE] but when I interchange the label(z) position …

Member Avatar for anand01
0
232
Member Avatar for sudarshansirsat

Hi, We have Unicode database and I have generated the i-reports and called them from java in my application but it gets opened my regional language fonts i.e (MARATHI) fonts are not shown properly by adobe reader in PDF format can anyone help me how to get Unicode support for …

0
53
Member Avatar for enterpise

[CODE]package test; import java.util.*; import sun.security.krb5.internal.UDPClient; import java.net.*; public class CMD { public static void main(String[] args) throws UnknownHostException, SocketException { DatagramSocket sock = new DatagramSocket (); Scanner keyboard = new Scanner(System.in); String fisrtarg=null; // System.out.println("Enter CMD"); // fisrtarg = keyboard.nextLine(); if (args.length > 0) {//this is important if no …

Member Avatar for enterpise
0
205
Member Avatar for Rajesh Voleti

Hi I am currently doing a project on the aglets. I have a problem in the installation of tahiti server. I have downloaded the asdk 1.0.3 and set the environment variables. Then i run the agletsd (tahiti server file) as administrator and followed the initial steps. Then a command prompt …

0
31

The End.