32,199 Topics
| |
here is my code import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.*; /** * * @author Sugirthan */ class Node<E> { int ser; public double[] data; public Node(int ser,double[]data) { this.ser=ser; this.data = data; } } public class Tree<E> { Node a; double [][] data = … | |
Hello, I am developing an Andorid application and I am having troubles with a line of code. I am getting x and y coordinates that have been stored as strings then I try to convert them to integers with x = (int) Long.parseLong(loc1); (x is an int). I have tried … | |
Hello. I have this question: "Amend the subclass of Holiday called Premier with an overridden equals method. Test this method in an orchestrating class with objects of Premier that contain the same data values and with objects that contain different data values." I have searched high and low for a … | |
| Hey everyone, I am making a nqueen program that’ll read me an array of the position of the queen. I developed to different methods to do this. One is the recursion way and the other is the iteration method . My problem lies in the recursion. I am trying to … |
| Hey everyone. As always I'm sorry for my noobness when it comes to java, but I got a question I can't seem to find answered anywhere else on the web. I'm trying to make a simple program that takes whatever number the user types in, and makes a linked linked … |
I am using JUnit for the first time and I have small problem: the setUp() method doesn't seem to work for me. public class ClientTest { private Client a; @BeforeClass public static void setUpBeforeClass() throws Exception { } @AfterClass public static void tearDownAfterClass() throws Exception { } @Before public void … | |
I am trying to get this class put together but I've always had trouble figuring out constructors. I don't know what to set the data fields in Customer(int customerID, int checkoutTime, int arrivalTime){} // DO NOT ADD NEW METHODS OR DATA FIELDS! class Customer { private int customerID; private int … | |
I need any Open Source Sentence Grammar Corrector for one of my projects. I searched it on Google but couldn't find any. All the results coming link to only Grammar Checker tools only not grammar corrector. Please suggest me any open source tool which can correct the grammar also or … | |
Hey guys, I'm trying to conver a while loop from C++ to java. And I'm having a problem with my while loop. The original c++ code. // Out of cashiers? // Get next frontBusyCashierQ // Is cashier's finish time now? while(!service->emptyBusyCashierQ() && (service->frontBusyCashierQ(cashier), cashier->getEndBusyTime() <= currentTime)) { ...... .... ... … | |
So im working on a project where im supposed to dynamically load the contents of a .csv file into the database.I have been hard coding the path of the file till now like * inserted = insertFromFile("C:/Users/Student/Desktop/Book1.csv",connection, "customer"); * however now i have to read multiple files from a folder … | |
I have this Die class, which I am working on for a game called Craps. My old method works, but I wanted to try to use dice with a higher number than 6. I can get the program to accept my user input, but how can I get it to … | |
Hi guys Im developing this java application and i have the following hurdles: a) I would like to develop an installer for all platforms(including windows,linux and Mac). b)Can someone please illustrate clearly how to connect to a mysql database in java after having downloaded the driver(connector/j) and having imported all … | |
Hello, I need help with my app. It works great, but when I build the project, the program doesn't want to connect to database (when Netbeans is off), it writes error: java.net.ConnectException: Error connecting to server localhost on port 1527 with message Connecton refused. I have derbyclient.jar imported to libraries, … | |
If i have a jar file on a server, and i have a program that needs to use the file as a dependency on the server also. How could i patch up the code to build without the dependecy before i deploy it. I know it can use the dependency … | |
i'm an IT student. Our Instructor gave us assignment to edit and delete txt file. how to edit and delete text file in java? can you give me the code ? | |
Hi, I have a swing application which works on CSV file. It reads full file line by line, computes some required statistics and shows output. The Upper part of output screen shows each record from file in that order in JTable, whereas lower part shows statistics computed based on that … | |
public class Twisty { { index = 1; } //need clarification here int index; public static void main(String[] args) { new Twisty().go(); } void go() { int [][] dd = {{9,8,7}, {6,5,4}, {3,2,1,0}}; System.out.println(dd[index++][index++]); } } In the above code, inside the instance initialization code, index is used. But it … | |
Hey guys, I am trying to make a program that allows you to input music artist into an array. The array row length is dependent upon a number entered by the user. There are only three column. I am having trouble with a line inside the for loop printing twice … | |
I am trying to write a program that will allow the user to search for a first or last name within a document full of people's names, and respond with the position of that name within the .txt file. What I have right now keeps returning -1 for the position … | |
hello im new in java and i have to do simple program and can read from txt file | |
Hello, The following program has a JFrame which contains an image, JTextArea and and a textfield. How can I display the image inside the text area? I will be grateful for any help! Thank you! import javax.swing.*; import java.awt.*; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.awt.event.*; public … | |
Hi I'm currently writing a program which applies collision detection to balls on the screen. My code works to a certain extent (the balls collide however they do not rebound away from each other) but it is not written efficiently. Here is the code that partially works: private void checkForCollision(Ball … | |
I have an ArrayList Contain Strings as follow 1, 200, 2 , 434 , 3 , 400 , 4 , 500 ............................... and so on how i can remove the number 1,2,3,4 i tried the followinh code but its not worrking for (int i=0;i<content.Size();i++){ if(i%2== 0 ) // if the … | |
So i have a java program running as a lib on a server. I need to just simply run a method within that library. In order to do so through J2EE, i need to get a call from a JSP -> EJB ->ResourceAdapter->Method. So i have the Reasource Adapter and … | |
I am trying to create a 2d table that asks for user input to create table size, adds all the numbers across each row, and creates the next row by multiplying by the first row. Here's what I have and it's now giving me an "Exception in thread "main" java.lang.NullPointerException" … | |
can anyone show me the point to get the tutorial on how to print using shared printer in java (windows os) ? thank you all | |
I have the following program, and I want to print the appropriate return statement for the numbers given. I am currently getting the error "cannot find symbol variable result, lines 18 & 19"... how do I get it to work, though? I've tried a few different ways, and this is … | |
i get an error "org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 18" i think my exception code is wrong. i don't know how to return an empty string when the user doesn't enter any number and clicks "continue". any suggestions <%@ page import="java.io.*"%><%@ page import="java.util.*"%><?xml version="1.0" encoding="UTF-8"?> … | |
Hey everyone, I am having some trouble parsing a string in java. I get a string from a databse, then I want to put it into a String Array to access two elements in the array (x and y positions). I think my problem is when I try to split … | |
Hello, My assignment in class is to write a notepad program in java, using only the .io and .awt extensions (I believe that's what they're called). Now, I've got every part of the program working, except the save and saveAs functions. I've spent roughly 5 hours looking for and trying … |
The End.