32,204 Topics
| |
This is the Logic for converting a Decimal number to Binary. I'm having confusion in getting it. It would be great if someone make me understand this. for ( long decimal = d ; decimal > 0 ; decimal/=2 ) { binary = decimal%2 + binary ; } If d=4 … | |
package maxmin; import javax.swing.JOptionPane; public class MaxMin { public static void main(String[] args) { final int Tnum = 5; int num[] = new int[Tnum]; for(int i=0; i<num.length; i++) { String numstring = JOptionPane.showInputDialog(null,"Please enter number: ","User Input", JOptionPane.QUESTION_MESSAGE); num[i] = Integer.parseInt(numstring); } int max = num[0]; for(int i=0; i<num.length; i++) … | |
Hello Every one I m new Struts 2 and i m trying to upload a image on server with the help of struts 2 but i was unable to do that i m pasting my code here .. please tell where i m wrong here is my action class package … | |
Hi, I advance thanks for your help Gentles! I am a Leanne, In my new Networking Java Program! (Consider an Small Office Please) At first Every Workers Should Login at Time (The Login details UserName ,PassWord and LocalTiming can stored in their own local database), When the Manager Come latter, … | |
I'm trying to make a deck of playing cards in Java, but when I run my code an error comes up saying java.lang.NullPointerException. This is my code: public class Deck { Card[] card= new Card[52]; Deck(){ for(int i = 0; i<13; i++){ card[i].value = i+1; card[i].suit= "Heart"; if(card[i].value==1){ card[i].value= 11; … | |
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" … |
The End.