32,204 Topics
| |
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 … | |
[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 … | |
"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 … | |
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 … | |
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.*; … | |
I m trying to pass a 10.10 value to double and it takes 10.1 instead of this? Any solution. | |
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 … | |
How to print this series using loop 1,1,2,3,5,8,11,19,30,49........... | |
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 … | |
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. | |
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, … | |
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 " … | |
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... | |
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 … | |
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 … | |
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, … | |
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 … | |
[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 … | |
Can two classes exist in a single .java file? Reply quick, please. | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 = … | |
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 … | |
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 … | |
[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 … | |
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 … |
The End.