32,199 Topics

Member Avatar for
Member Avatar for newcoder310

how to modify the contents of a file Example:: If there is a file with hello #how are you Then how to delete the # and maintain the same file

Member Avatar for masijade
0
106
Member Avatar for newcoder310

I've recently posted a thread called file modification and the problem has been solved........now could some1 kindly explain why is it necessary to delete and rename the file to insert or delete a character into the file at a particular location Thanks

Member Avatar for griswolf
0
77
Member Avatar for Latvija13

How would you go about skipping non-numeric characters in a string and only adding the sum of the numbers a multi line string?

Member Avatar for Latvija13
0
111
Member Avatar for acash229

Hey guys I am still learning how to use simple java. I want to try to do this program which i found in some book, but i cant seem to get how to started. They say its a beginners program, but i found it quite difficult on how to start. …

Member Avatar for acash229
0
153
Member Avatar for VernonDozier

OK, here's what I want to do (I realize the code below doesn't work, but it's what I would LIKE to do). I've converting things from C++ [code=JAVA] public void ChangePrimitiveArray(byte bytes[]) { bytes[0] = 1; } public void foo() { byte bytes[] = new byte[2]; bytes[0] = 4; ChangePrimitiveArray(bytes); …

Member Avatar for VernonDozier
0
214
Member Avatar for eikal

Hi im working on this program im getting a runtime error that says this ArrayIndexoutofbounds exception 0. heres my code [code] import java.util.Scanner; public class MillerCalculateTime { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter miles: "); double miles = sc.nextDouble(); System.out.print("Enter Miles per hour: "); …

Member Avatar for naief
0
179
Member Avatar for z00t

i have to construct a rectangle, print the location, then translate/print it 3 more times such that if they were drawn, they would form one large rectangle. [][] <- like so [][] here's the code & the error. C:\java>javac FourRectanglePrinter.java FourRectanglePrinter.java:11: [COLOR="Green"]incompatible types[/COLOR] found : void required: java.awt.Rectangle Rectangle box1 …

Member Avatar for Akill10
0
1K
Member Avatar for LianaN

Hi! I would like to read XML file from my SWING application, however [ICODE]list.size()[/ICODE] returns 0. Why does it happen? Thanks! [CODE] private void open() { SAXBuilder builder = new SAXBuilder(); File xmlFile = new File(openedFileName()); try{ Document document = (Document) builder.build(xmlFile); Element rootNode = document.getRootElement(); List list = rootNode.getChildren("Panel"); …

Member Avatar for LianaN
0
841
Member Avatar for LianaN

Hi! I would like to select images by using a rectangular area. All images that are inside this area, must be selected. I want this area to appear while mouse clicking and dragging. So, the size of a rectangular area should change dynamically according to a position of the mouse …

Member Avatar for LianaN
0
2K
Member Avatar for LegendX

[code=java]import java.text.DecimalFormat; import java.util.Scanner; public class Main { public static void main (String[] args) { String inputString; //For reading input. String input; //Read Input double automobileCost; double warrantyCost; double downPaymentAmount; double interestRate; double numberPayments; double salesTaxAmount; double totalPurchaseCost; double amountFinanced; double loanInterestRate; double loanLength; double monthlyPayment; double annualInterestRate; // Create …

Member Avatar for jon.kiparsky
0
167
Member Avatar for croker10

This is more than likely the dumbest sounding problem most of you will have ever heard of, but after three days of attempting to fix this myself, I have gotten no where. I am working on an older project, it works fine, but I need to upgrade it an add …

Member Avatar for croker10
0
235
Member Avatar for SeanC

Hi all, ive got a problem relating to the log4j.jar file (I suppose it would be the same problem regardless of what the .jar file is). I created a library based off the log4j.jar file, and the logging works and everything runs smoothly on my laptop. However, when I use …

Member Avatar for vealparry
0
120
Member Avatar for sateal8

Hello, I am having a hard time with a easy problem. I need to ask a user how many scores they would like to enter (up to 15) and then use a method to get the number of scores. in the form of Enter score 1: xx.xx Enter score 2: …

Member Avatar for sateal8
0
192
Member Avatar for cozmo87

I have hundreds of text files with data sorted in 3 columns and an unspecified number of rows. The number of columns can increase in the future, but will always be equal for all files. I want to combine these data into a single file with all the columns put …

Member Avatar for vealparry
0
135
Member Avatar for WolfShield

Hey guys! This is the code for a program I started today: [code=java] /* * IdeaCaptureMain.java * * Created on Jan 25, 2011, 4:33:45 PM */ package Idea; /** * * @author WolfShield */ public class IdeaCaptureMain extends javax.swing.JFrame { /** Creates new form IdeaCaptureMain */ public IdeaCaptureMain() { initComponents(); …

Member Avatar for vealparry
0
98
Member Avatar for lisaroy1
Member Avatar for jon.kiparsky
-1
99
Member Avatar for Valten1992

I have been doing an assignment for my my first year software course, in which we have to make a simple TicTacToe program in java. For the final 30% mark, we have to add a GUI in. Apart fro a tutorial only teaching me the basics (how to make boxes …

Member Avatar for lazeto
0
922
Member Avatar for hajjo

[CODE]public void buildTree(List<Fool> treeArr,Fool tr) { if(tr.getChild().size() == 0) { for (Fool cur : treeArr ) { if (cur.getParentId().intValue() == tr.getRight().getRightId()) { tr.getChild().add(cur); cur.setParent(tr); buildTree(treeArr, cur); } } } }[/CODE] there is around 10000 data, and the code is very slow. Its taking 8.5 second, I need to speed it …

0
55
Member Avatar for pscullion2001

I was wondering if someone could check this for me. Ive to write a loop in words, this is what ive came up with. while (there are days left in holiday) if (sunny) go to beach else go to swimming pool go home Basically its a program that tells you …

Member Avatar for javaAddict
0
106
Member Avatar for prince87

Hi Can some one give me some idea about code for icp protocol for client server Architecture in java. Thanks

0
53
Member Avatar for sciprog1

Hello Members, Can anyone point me to a web link which has the java code for a simple game that uses the keyword synchronized and the thread synchronization functions, wait() and notify()? Thank you!

Member Avatar for sciprog1
0
51
Member Avatar for theurbanist

Hey Everyone, How would you go about writing a program that draws an image of an ice cream cone, using JFrame and JComponent classes, with a triangle on bottom and a circle on top?

Member Avatar for Akill10
0
111
Member Avatar for sitajaf

Hi, am trying to use a multicast socket in an application but I constantly get this exception; java.net.SocketException: error setting options. I have failed to find its cause and how to solve it. Pliz help (what could be causing it, and how can i solve it? thanx.

Member Avatar for sitajaf
0
191
Member Avatar for ahmed_fawzy

why when i write this down : [CODE] private Statement getOrders_st=null; public ResultSet getOrders(String UserName) { ResultSet Rs=null; try { getOrders_st = Conn.createStatement(); Rs = getOrders_st.executeQuery("select order_history , ordr_date , ordr_total from orders where ordr_userid = '"+UserName.toLowerCase()+"'"); } catch(SQLException ex) { ex.printStackTrace(); } return Rs; }[/CODE] give NullPointerException at [CODE]getOrders_st …

Member Avatar for ahmed_fawzy
0
151
Member Avatar for george61

There is a working code about a program in which you should create differen Cat objects with name and color parameter and apply method to the objects. The problem is that I get the method working for only the last cat [CODE]public class Cats { public static String name; public …

Member Avatar for masijade
0
228
Member Avatar for M.Ovais

how we create a button using swing class..... I need help b/c I want to make a calculator but I am beginner and i dnt know swing class... Plz help me to create a button.....!!!!!!!1

Member Avatar for Eric Cute
0
62
Member Avatar for RicardoE

Hello, can you guys please sugest a way to have today date substracted 7 days, and have al of this 7 days into one String array? thanks.

Member Avatar for RicardoE
0
166
Member Avatar for 09tikimo

I really need help, my 1st assigment is due tomorrow and i've been working on it for a really long time and is just not getting it!!!! So please help me, it will be greatly appreciated. These are the questions that I haven't been able to figure out. Add a …

Member Avatar for Akill10
0
216
Member Avatar for Sparky_

Greetings, I am about 4 hours into JAVA and am making a big mess of it. Last night (at home) I installed the latest JAVA and NetBeans and got a "Hello World" Today I installed the 2 at work and am getting errors involving: "NoClassDefFoundError" (even with what worked last …

Member Avatar for ~s.o.s~
0
177
Member Avatar for WolfShield

I have a calculator program I am working on, it works except for one thing. When I type a large number into the calculator, say 125^4 it comes out with: 2.44140625E8. Any ideas on how to get this in-build function turned off? Thanks! -[b][i]WolfShield[/i][/b]

Member Avatar for bibiki
0
102

The End.