32,199 Topics

Member Avatar for
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
281
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
678
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
402
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
846
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
925
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
Member Avatar for Razer13

[CODE]public JLabel SetImage(String path) throws IOException { ImageIcon myPicture = new ImageIcon(path);//ImageIO.read(new File(path)); JLabel picLabel = new JLabel(); picLabel.setBounds(0, 0, 2, 2); picLabel.setIcon(myPicture); pnlImage.setLayout(null); pnlImage.add(picLabel); pnlImage.repaint(); pnlImage.revalidate(); return picLabel; } try { String Ref = txtRef.getText(); SetImage(); JLabel label = new JLabel(); label = SetImage("C:\\Users\\Documents"); App\\ImagesDoc_001.jpg"); pnlImage.setLayout(null); pnlImage.add(label); pnlImage.repaint(); pnlImage.revalidate(); …

Member Avatar for NormR1
0
135
Member Avatar for scheppy

Hi all I'm wondering how i add Action listener to this Button It has no text, just an image, from an ImageIcon I tried I3 for the action listener but i doesant work [CODE] ImageIcon I3; I3 = new ImageIcon ("carrier.gif"); J1 = new JButton (I3); J1.addActionListener (this); J1.setBounds (420, …

Member Avatar for scheppy
0
141
Member Avatar for timmy568

Hi guys, I was doing my project when i came across this error: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(String.java:686) at Screen.screenRunner(Screen.java:84) at Screen.main(Screen.java:90) I am also having problems getting my program to accept user input(height and width). [CODE]import java.util.Scanner; public class Screen { …

Member Avatar for timmy568
0
229
Member Avatar for Mr.BunyRabit

hey there. Im using Netbeans. i have a form where there is a button edit. when i press it, other form opens, and the selected item on the previous page has to be edited in the databse. So bottom line, i have to get a String / int that i …

Member Avatar for stultuske
0
170
Member Avatar for syeda amna

hi What is the difference between in JFrame and JWindow? If I want to develop a a desktop application either I have to use JWindow or JFrame.

Member Avatar for mKorbel
0
2K

The End.