32,199 Topics
| |
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 … | |
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] | |
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 … | |
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) … | |
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) { … | |
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; … | |
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 … | |
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 … | |
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. | |
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 … | |
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 … | |
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 … | |
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 … | |
Hi guys, I am pretty new to java, and I have to write out an algorithm for a few operations following each other. The point I am at, is adding two numbers and then dividing the product. This is the code I have come up with so far, excuse the … | |
Hi, I created a program using the linkedlist package. I encountered an error when I tried to insert an element... By the way here's my code... [CODE] import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.util.*; class guiListOperations3 extends JFrame implements ActionListener { static LinkedList <String> list=new LinkedList <String>(); static JLabel … | |
Searched online and found ways that people are able to do this but I can't seem to get mine to incorporate all the words. Here is what I'm trying to do followed by my 7th try at coding it. Thanks in advance for any advise you may be albe to … | |
write a function that will reverse the numbers in a row? so far done public void fliprow(int r) { int temp = m[r][m[r].length-1]; int ct = 1; for(int column = m[r].length; column >= 0; column--) { m[r][column] = m[r][ct]; m[r][ct] = temp; temp = m[r][m[r].length-ct]; if(ct < m[r].length) ct++; else … | |
Hi, I am getting "java.lang.ArrayIndexOutOfBoundsException" exception in my program. Below is the code. [CODE] int ind = 0; for(int i = 0; i < height; i++){ for(int j = 0; j < width; j++){ byte a = 0; byte r = bytes[ind]; byte g = bytes[ind+height*width]; byte b = bytes[ind+height*width*2]; … | |
I have a database application in Java. They want to access the data from primarily Excel2007 and secondarily Visual basic. I need some advice about with what library could I easily add this functionality. I've tried Simple OLE DB Provider with some JNI, but it's unstable and I'm... grrr. So … | |
As the title says, I saved over my code. I am screwed because I really need the old version. I have the original compiled .class file... can i some how get the code from inside there? or recover an earlier version of this java file (which is/was stored on my … | |
[CODE]import java.util.*; import java.text.*; public class Interest { static DecimalFormat fmt=new DecimalFormat("0.00"); //2 decimal place. static Scanner input=new Scanner(System.in).useDelimiter("\r\n"); static double[] principle = new double [10]; static double[] rate = new double [10]; static double[] interest = new double [10]; static double[] days = new double [10]; static int i; … | |
hi i am using windows 7 in laptop. i download java thro net. i dont know, how to run in windows 7.also in cmd prompt, java have r not. pls tel me elaborately step by step pls | |
Hi Everyone, I have rgb values for each pixel.I have stored each red,green and blue values in three arrays red[][],green[][] and blue[][]. Now I want to display a rgb image using these values. Please suggest me how to do this. Thanks. | |
hi I am unable to find any solution on how to create run time radio buttons . eg. if I selcet source and destination then all the train(with its detail like train no. etc) in this route will be displayed with radio buton. just like we see in railway reservation … | |
I want to insert an image from my hard disk into the application but unfourtantly my code doesn't work and I can't determine what causes that the image disapear.[CODE] import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.text.Text; import javafx.scene.text.Font; import javafx.scene.image.Image; import javafx.scene.image.ImageView; /** * @author city */ def image = Image … | |
Hello, I am doing my first JFrame. I want it to have a button where the user clicks it and music plays. I already made the button (called b1) but i can't seem to find code for the music to be imported and played. I have tried a whole bunch … | |
Hi, this is my first program using JUnit and I am very lost, this is the piece of code that I am running the test on [CODE] public class BoundedBag { // Data members private int[] contents; // Elements of the BoundedBag. private int topPosition; // Index of highest used … | |
Hi, I am having problems with this piece of code and maybe I am just not understanding how to do it, but can you please help me out or give me some tips. This is the description: You will implement your BoundedBag as a partially filled array. The array contents … | |
I would like to complete a project that requires a name as a console input, but returns an output of that name in reverse. It should only use for-loops and strings/substrings. I think it needs to use an array to get it done. I am right? Below is my attempt … |
The End.