36,051 Topics

Member Avatar for
Member Avatar for lorettah

import java.io.*; public class Appliance { public static void main(String args[]) { try { File file=new File("Name.txt"); FileReader f=new FileReader(file); int ch; while((ch=f.read()) { System.out.print((char)ch); } } catch(FileNotFoundException fnfe) { System.out.println("Exception: "+fnfe.toString()); } catch(IOException ioe) { System.out.println("Exception: "+ioe.toString()); } } }

Member Avatar for jon.kiparsky
0
123
Member Avatar for ajst

Hi, I've got a job interview coming up and was wondering if people would be so kind to help me with some revision for the interview. It's it a programming role(surprisingly) so would be greatful if people would post the questions they have been asked or ask in job interviews. …

Member Avatar for Moschops
0
92
Member Avatar for J-Dubs

Hello, I am a student taking APCS and I am getting very frustrated with this program. Usually I can get everything figured out but I can't figure this out. It compiles but when I run it, it seems to give the wrong number for the number of bombs in adjacent …

Member Avatar for J-Dubs
0
2K
Member Avatar for jdog2u

Hello World. Thanks for any help in advance. I am in a basic java class. One of our first assignments is to develop this currency calculator. I have completed the code and it works fine. My only concern is that i could loose points if I have too much code …

0
56
Member Avatar for i.ibrahem

I need help please, I want to write a program that requests and reads two integers on one line representing a range, the program should output the sun of all even numbers in the range. if anyone can help please do, thank you.

Member Avatar for Akill10
0
249
Member Avatar for Progr4mmer

Im making an applet that moves a red ball using the WASD keys but it doesnt work for some reason help? [CODE]package Game; import java.applet.*; import java.awt.event.*; import java.awt.*; public class AppletOne extends Applet implements Runnable, KeyListener{ int x_pos = 10; int y_pos = 100; int x_speed = 3; int …

Member Avatar for Progr4mmer
0
200
Member Avatar for Lemonader

Hi. It says that the operator and return statement don't work. Can someone please explain what is wrong, and why it's wrong? I don't get it. [CODE] package hello; private class Person { private string firstName, lastName; private Date birthDate; public Person(String fN, String lN, int month, int day, int …

Member Avatar for Progr4mmer
0
99
Member Avatar for babynme

i am currently using Mircosoft Windows XP (32-bit) Version 5.1.2600 Service Pack 3 Intel(R) Pentium(R) 4 CPU 2.53GHz (2532 MHz), 1280 MB RAM (NVIDIA GeForce FX 5500) [U]My Problem[/U] when i run java program the CPU USAGE will run to 100% . i tried to reinstall but doesn't work. i …

Member Avatar for gerbil
0
172
Member Avatar for boifang

[CODE]class MOrders { int nooforders; // Data members of the class public int getorder() { nooforders = 500; } public void displayorders() { System.out.println("The number of orders to be delivered: "+ nooforders); } public static void main(String args[]) { MOrders obj = new MOrders (); obj.getorder(); obj.displayorders(); }[/CODE] getting a …

Member Avatar for masijade
0
73
Member Avatar for miku003

I'm trying to make an array-based queue that inserts and removes the elements... The default array is {0,0,0,9,10}. after the 0's are filled up it should say that its Full and will return to the loop. I'm having trouble making 3 particular methods which is dequeue, isEmpty, and isFull.. [CODE]class …

Member Avatar for miku003
0
189
Member Avatar for Abdel_eid

i googled on how to create a class dynamicly and i found that code [code] Date today = new Date(); String todayMillis = Long.toString(today.getTime()); String todayClass = "z_" + todayMillis; String todaySource = todayClass + ".java"; public static void main (String args[]){ MakeTodayClass mtc = new MakeTodayClass(); mtc.createIt(); if (mtc.compileIt()) …

Member Avatar for ~s.o.s~
0
352
Member Avatar for McCurry0x77

What is the best way to assign values to variables of various data types from reading a file (while importing as few things as possible and making use of the simplest code)? I need to write a program which can assign values from a .dat file, if that's relevant. If …

Member Avatar for masijade
0
125
Member Avatar for ajijacobm

hi, i have problems in accessing file through ftp from other computer.. i have a code, but it works fine in one computer... but i need to access a file stored in another computer connected through LAN. [CODE=JAVA] try { URL url = new URL("ftp://PROJECT:123456@192.168.1.117:21/images/1.jpg;type=i"); URLConnection con = url.openConnection(); BufferedInputStream …

0
71
Member Avatar for BenzZz

Hello world... xD Now the bad joke's over, I'm Ben, currently halfway through my second year at university studying BSc Hons Computer Science. Thought i'd join these forums as they appear friendly and helpful to those with any IT related problems so maybe i can get some help here in …

Member Avatar for debasisdas
0
134
Member Avatar for frankel81

Hi guys, I am having A LOT of trouble with this problem. If someone can help me out that would be so appreaciated. ATTACHED- below is my problem in my pdf file I email'd my teacher and this was his response. " you need to implement the three classes that …

Member Avatar for peter_budo
-1
110
Member Avatar for Amoryethel

Hi. I'm making an interface and a class that correlates with the client code below. Everytime I try to compile the client code, I get the following errors: [quote] Bird.java:15: = expected private Color col; ^ Bird.java:16: = expected private Point pos; [/quote] As well as a few others. For …

Member Avatar for Amoryethel
0
145
Member Avatar for Ryan61343

I am working on a application for figuring how much of each kind of coin One should get back when they give say 99 cents as the amount of change. I have a way to do it which involves simple integer division and subtraction but i was wondering if anyone …

Member Avatar for ztini
0
102
Member Avatar for JohnNoob

Hi all, I am writing a plug-in for imageJ on java. I have an image to edit, and the image is an 8-bit grayscale image. I need to make the white pixels (255) in the image to red pixels. Meaning, I have to convert the picture to a 24-bit RGB. …

0
92
Member Avatar for joeyfm

So I am working on a java project for a college asssignment (im a student ...) and dont know what I have done... but my sub menu (when create, delete find or update is clicked) wont display. what should happen is create is clicked and the sub menu displays with …

0
68
Member Avatar for geoffy0404

Title kinda says it, I was wondering if anyone has heard of this what im about to ask. If i program code on ubuntu 10.04 using netbeans, and code in C. can I somehow save the file from netbeans, and transfer/make a conversion for the netbeans file to be able …

Member Avatar for geoffy0404
0
103
Member Avatar for montalbano80

I have to write a simple program that declares three arrayLists referenced by the objects named priceList, quantityList, and amountList. Each arrayList should be declared in main() and should be capable of holding a minimum of 10 double-precision numbers. The numbers that should be stored in price are 10.62, 14.89, …

Member Avatar for ztini
0
170
Member Avatar for curbster

Hi I'm in some serious need of help with a homework assignment. I have to write a program that takes a three word phrase from user input (through JOptionPane) and my code has to convert it to uppercase and then just take the first letter of the three words. here …

Member Avatar for ztini
0
3K
Member Avatar for Zabzacon

Right now I have three classes from following a tutorial I found online. It draws a red square and a blue square to the screen and lets the user control the red square. The issue I am having is getting it so that when they intersect from the bottom of …

Member Avatar for Ezzaral
0
147
Member Avatar for McCurry0x77

I'm required to construct a three-dimensional array (a "universe"), but unlike traditional array navigation where you go to the end of the column, row, etc., increment and start at the beginning, I am required to move in reverse (like actually navigating a cube). The precise instructions: - Move along a …

0
101
Member Avatar for Phaelax

I'm writing an inventory program for my uncle's warehouse, which has never been counted in 20 years. (yea it's taking me a week so far and still counting parts) I want the program to be serverless and just run on his laptop (which I'm still fixing also). I thought of …

Member Avatar for Ezzaral
0
104
Member Avatar for eikal

Hey guys, im doing a rock paper scissors program for h/w i got it done but im getting an error and i cant figure out whats wrong. [code] public static void main(String[] args) { int pcpick; int userpick; String userChoice = JOptionPane.showInputDialog("1 Rock, 2 Paper, 3 Scissors"); int choice = …

Member Avatar for eikal
0
184
Member Avatar for Sonny101

Hi all, I cannot seem to grasp the use of wrapper classes, or rather how to use them. I am in the middle of practicing for an exam tommorrow but I am a little stumped with the following task: [I]Create an overloaded setValue method that recieves a String parameter. This …

Member Avatar for jon.kiparsky
0
147
Member Avatar for eman 22

what's thew benefits of dynamic loading in java? and How can I load a classes befopre run the program?

Member Avatar for ~s.o.s~
0
102
Member Avatar for Lourdupinto

Hello friends kindly help me, Which is purely object oriented language Java or c++? If it is java why it is? how it is? If it is c++ why it is? how it is? Kindly help me...........

Member Avatar for Lourdupinto
-3
151
Member Avatar for triceratops

hi guys, i am asked to do a game where the player plays against computer where each one has to put into the pursue a piece of coin, it cas be 5cent, 10, 25 or a dollar, the one that puts the biggest piece can take the change for it …

Member Avatar for jon.kiparsky
0
113
Member Avatar for alvalany

I was trying to create a gui based application in netbeans. What I want is a lot of panels stacked one above the other. So that when one of the option in a panel is selected, tthe related panel should be displayed above the original panel I know this can …

0
95
Member Avatar for MIA6

Hi, I am pretty new to Java. I have some basic questions. [CODE] public class Array { private Object[] values; private int count; private boolean sorted; public Array (int max) { this.values = new Object[max]; this.count = 0; this.sorted = true; [/CODE] I am kinda confused at line 9. It …

Member Avatar for MIA6
0
143
Member Avatar for EmbeddedHelp

Hi all, I have created the following code that deletes a Vector entry. Currently it gives an error if you enter a string that is not present in the Vector. Can anyone recomend a way of looping back to the original text entry point, rather than terminating the program if …

Member Avatar for javaAddict
0
158
Member Avatar for anumash

This program is based upon the quadratic equation. If I enter a negative discriminant it prints NaN instead of "No real solutions". Any help will be appreciated. Why is it printing NaN twice??? What modifications are needed in the code? Please help!!! [CODE]import java.util.Scanner; class QE{ private double d=0; private …

Member Avatar for anumash
0
121
Member Avatar for stephy1

java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.[CODE] String id= t1.getText(); int c1=Integer.parseInt(rc1.getText()); /* rc1 is a radiobutton */ statementobj.executeUpdate("Update tablename(fieldvalue) values('"+c1+"')where ID='"+id+"'"); [/CODE]

Member Avatar for stephy1
0
194
Member Avatar for ypks_destiny

I want a text field which should have database values....(like dropdown list) from that list i can select text which is in database... Can any one help me out its very urgent.......

Member Avatar for ypks_destiny
0
694
Member Avatar for KKR_WE_RULE

The output I am getting is : [CODE]You will be entering the names of ten students their corrsponding marks in Physics, Chemistry & Maths. Enter the name of the student : student1 Enter the marks in physics of STUDENT1 : 43 Enter the marks in chemistry of STUDENT1 : 54 …

Member Avatar for KKR_WE_RULE
0
142
Member Avatar for lisaroy1

Yesterday i gave an interview and faced A QUESTION which i cant answer. How can we Compare two PDF files using JSP? Please help

Member Avatar for peter_budo
0
104
Member Avatar for ypks_destiny

I want a text field which should have database values....(like dropdown list) from that list i can select text which is in database... Can any one help me out its very urgent....... once see [url]www.justdial.com[/url] under "City" text box i want exactly like that ...i also want to match the …

Member Avatar for pritaeas
0
825
Member Avatar for pssubash

Hi, I created a class named [B]Test.java[/B] [CODE] public class Test { public Test() { System.out.println("Testing......"); } } [/CODE] It sucessfully compiles. Then i create another java class [B]Menu.java [/B]and here i trying to create an object of the Test class. [CODE] class Menu { public static void main(String[] args) …

Member Avatar for javaAddict
0
328
Member Avatar for stroper

I am making a console application. I want to make a method to stop the application. Can anyone help please. This is my code. [CODE]public void menu() { System.out.println("1 to go to menu help, 2 to go to head menu 3 to stop"); int optie = scanner.nextInt(); switch (optie) { …

Member Avatar for stroper
0
129
Member Avatar for mangopearapples

Hi, for some reason, my JScrollPane isn't working with mt JTextArea. Probably the most important part: [CODE] JTextArea TextArea; JScrollPane scroll; TextArea = new JTextArea(); scroll = new JScrollPane(TextArea); add(TextArea,BorderLayout.CENTER); add(scroll,BorderLayout.LINE_START);[/CODE] Whole code if you're interested in what I'm making: [CODE]import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.BufferedWriter; …

Member Avatar for mangopearapples
0
280
Member Avatar for careless_monkey

I'm just starting out on my Networking Assignment and I'm already stuck. Assignment asks me to check a the user provided website for links and to determine if they are active or inactive by reading the header info. So far after googling, I just have this code which retrieves the …

Member Avatar for masijade
0
194
Member Avatar for carinlynchin

hi, i have no idea why this isn't working....I placed some system.out.println's for debugging purposes and what I found is that after entering the "new game" method, thethe message shows in the console, but then the random initialization occurs, after which I placed another system.out and its not showing which …

Member Avatar for carinlynchin
0
203
Member Avatar for sj5536

How do i count space between two string in java for ex. String s = "This is my car"; i have to count number of space between this and is , is and my, and my and car.

Member Avatar for ztini
0
2K
Member Avatar for vin24
Member Avatar for SolidSora

I'm supposed to use an instanceOf for an assignment, and it says the type is incompatible. Here is my code: package City; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Brian */ public class City …

Member Avatar for ztini
0
97
Member Avatar for Taimoor Rana

I want to load an image for each different shoe and I'm using JLabel to help me do this. I put the image's path in the JLabel constructor but when the code runs, it doesn't display any image. Instead of an image, the image path is written. appreciate any help …

Member Avatar for ztini
0
246
Member Avatar for lashbandi

Hi... i am trying to run this program...and it stays that it does not have a main method... public static void... but i have the public static final int... please let me know how i can get this program to run..thanks [CODE]public class CaesarCipher { public static final int ALPHASIZE …

Member Avatar for ztini
0
210
Member Avatar for EmbeddedHelp

Hi all, Currently my code accepts x10 Floats into a Vector. How would I change it to terminate the loop and output all stored values when a negative number is entered? [CODE]import java.util.*; public class acceptFloats { public static void main(String args[]) { Vector<Float> vec = new Vector<Float>(); Scanner scanner …

Member Avatar for ztini
0
93

The End.