32,204 Topics
| |
in line 7 I have three errors. TextFieldOutputDemo.java:7 '.class' expected (where it points to 't' in "throws") FileOutputStream(String, boolean)throws FileNotFoundException; TextFieldOutputDemo.java:7 ';' expected (where it points to 't' in "throws") FileOutputStream(String, boolean)throws FileNotFoundException; TextFieldOutputDemo.java:7 not a statement (where it points to 'F' in "FileNotFoundException") FileOutputStream(String, boolean)throws FileNotFoundException; [CODE]import java.io.*; public … | |
I need to keep a string from resetting each time the class is called, but haven't found any good way of doing it ... Every time [B]if (block != LastC){}[/B] evaluates to true. ( which shouldn't happen very often ) [CODE] --- code snip --- public class Player_Move implements Listener … | |
An assignment I'm working on requires me to write a method for the sole purpose of calling that method in a later method. As such I am required to write the first method to not display anything on screen and then I need to comment the calculation within the method. … | |
i was watching a tutorial about bubblesort, and i followed all the instructions the difference is that the tutor is using System.out while im using JOPtionPane, please help me thank you help me find my error and help me run it correctly! [CODE]public static void main(String[] args) { // TODO … | |
After an hour of browsing the web, I decided to ask for help for my IB project (can't paste my whole code or I'll be cheating off myself). I don't have much experience, so please explain whatever syntax your solution may have (please don't say rewrite the whole thing). Anyway, … | |
this my code import java.awt.*; import javax.swing.*; import java.awt.event.*; public class Panel extends JPanel implements ActionListener{ private JTextField weight,height, answer; private JButton calc, clear, exit; public Panel(){ this.setLayout(new GridLayout(2,1)); JPanel topPanel = new JPanel(); topPanel.add(new JLabel("WEIGHT(KG)")); topPanel.add(weight = new JTextField(5)); topPanel.add(new JLabel("HEIGHT(M)")); topPanel.add(height = new JTextField(5)); topPanel.add(new JLabel("BMI")); topPanel.add(answer =new … | |
How i can do a server that can be handle a very large number of clients (in same time) between 250,00 to 1,000,000 clients or more ? , Because when large number of clients connect to the normal server that failed. | |
Hi I"m receiving this on my program. I know that this happens when i choose a location outside of the map, but how do i fix this? Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1 at GameMap.getLocation(GameMap.java:56) [COLOR="red"]return map[xdimension][ydimension];[/COLOR] at Game.startGame(Game.java:87) [COLOR="Red"]System.out.println("New Location:" + mapMgr.getLocation(X,Y).getLocation() + ", "+ mapMgr.getLocation(X,Y).getDescription());[/COLOR] at Game.main(Game.java:168) [COLOR="red"] … | |
[CODE]public class Array { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub String ctr=""; int size= Integer.parseInt(JOptionPane.showInputDialog("Enter any 10 numbers:")); String num[]= new String [11]; for (int i=1; i<=size;i++){ num[i]=JOptionPane.showInputDialog("num["+i+"];"); ctr=ctr+num[i]+ " "; } JOptionPane.showMessageDialog(null, ctr); } } [/CODE] thats my code, … | |
Hi there, I wrote a VERY simply program attempting to use a recursive function to calculate a math problem and spit it out onto a table. It prints once and then I'm getting a stack oveflow error on line 8 and then line 12: [CODE] package recurtable; import java.text.*; public … | |
I'm making a maze game for a project in school, and as such i need to create boundaries for the game. not only for the outer walls but also inner ones of different and sometimes not perfect squares. I was just wondering how i should go about doing this? Is … | |
the error goes like this: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order (custNo, dateOrder, totalPayable) VALUES ('', '2012/Feb/19 16:09:02', '0' at line 1 // HELP T_T. this project is to … | |
Hi there guys can someone explain to me how I can increment a value within a field in my database each time I execute my query?. As I cannot seem to find a way to do this. Below is my structure for reading + writting to my database if you … | |
Suppose that the tuition for a university is $ 10,000 this year and increases 5% every year. Write a program that uses a loop to compute the tuition in ten years. Write another program that computes the total cost of four years worth of tuition starting 18years from now. I … | |
I have a question why is important to supress warnings in java, i notice my professor do that all the time [CODE] @SuppressWarnings("unchecked") [/CODE] | |
Here is my java connectivity code to Oracle [CODE]public class OracleConnectivity { public Connection con; public Connection getConnection () { try { Class.forName("oracle.jdbc.driver.OracleDriver"); con=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:dhanesh","dhanesh","root"); Statement s=con.createStatement(); s.executeUpdate("insert into test (num,txt) values (2,'hi')"); s.close(); con.close(); } catch(Exception e) { System.out.println("Connection failed"); e.printStackTrace(); } return con; } public static void main(String[] args) … | |
Here is my code:- [CODE]/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package wrie.and.read; /** * * @author Administrator */ import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.*; import javax.swing.*; public class WrieAndRead { JFrame frame; JTextField field; /** … | |
[CODE]class Animal { private String type; Animal theAnimal = null; // Declare a variable of type Animal public Animal(String aType) { type = new String(aType); } public String toString() { return "This is a " + type; } } class Dog extends Animal{ private String name; // Name of a … | |
I have been working on this topic for three days. I can not seem to solve the problem. I need to generate tree when the user enter binary with the corresponding variable the tree should be generated recursive until a certain condition is met. This topic is new to me. … | |
DEPOSIT and WITHDRAWAL ERROR MESSAGE: Input Amount:Exception in thread "main" java.lang.NullPointerException at Soft_eng.ATM.main(ATM.java:226) there is a logic error or whatever error in deposit and withdrawal. :( there is a little problem in new account. when the system reaches 11 records it cause to force shutdown of this atm system. [CODE] … | |
Hi, So i got pretty far whit Java i covered basic operation, GUI w/e MVC design etc. It been a fun year learning Java. Now i want to make an application for communication between two points similar to a TFTP Server/Client. So this is how i visioned this to go: … | |
If I close off the for loop it works but I need to get the output to show as a dialog box as well. I need the output to show inside a dialog box: Output should include count of numbers entered the sum of the numbers the average of the … | |
Hi There is something about this code that does not seem right has anyone got any ideas? It does not matter what it does. I mean from a constructor/inheritance point of view. Some of the points I made were one constructor was passing a null value, which in turn was … | |
Hi, I'm trying to learn some Java for fun and got a question about comparing integers. If I wish to compare int a to int b and check for equality that's pretty straightforward and easy, but if I want a method to return equal for different values I get a … | |
| My objective is to implement a GUI calculator in java. I am thinking of passing the expression entered by the user to bc and then get output from terminal and print to user. My question is [LIST=1] [*]How to execute a terminal command from java so that i can pass … |
Hello, I would like to know any information about "UML Diagram Generator" from the code or if there is any good software which can enable me to make quick UML Diagrams from the code for my University Assignments. I have been looking for one but did not find anything good. … | |
I am trying to get the program's decimal to output in two decimal places after the decimal. Please advise. [CODE] // MilesPerGallon.java // Program designed by XY import javax.swing.JOptionPane; // Needed for JOptionPane. import java.text.DecimalFormat; // Keeping proper decimal format. public class MilesPerGallon { public static void main(String args[]) { … | |
I don't know how to write code to exit for this program.someone please help me :( [CODE] import java.awt.*; import javax.swing.*; import java.awt.event.*; public class Panel extends JPanel implements ActionListener{ private JTextField height, weight, answer; private JButton calc, clear, exit; public Panel(){ this.setLayout(new GridLayout(2,1)); JPanel topPanel = new JPanel(); topPanel.add(new … | |
Hello, I have a Computer Science project for school. I am done writing the full code but I am missing one of the requirements. Some of the text have to be aligned to the right. Here's an excerpt from my code which I want to change the alignment: [CODE] System.out.print … |
The End.