35,618 Topics
![]() | |
My server is in python and I'm trying to read and write to socket using ObjectInput/Output Streams whenever i write to socket there is some characters written in socket before my writeObject() command is executed and whenever i tried to read the data from socket using readObject() , it gives … | |
Hey, I created a phone directory program. But I was wondering if I could get some hints on how I could create a txt file and add, delete names and numbers on the txt file. [CODE]import java.util.*; import java.lang.*; import java.lang.Object; import jpb.*; public class PhoneDir { private static LinkedList … | |
ChatBot class: A chatbot is a computer program designed to simulate an intelligent conversation with one or more humans. In this lab, we will establish the framework for our chatbot, which will be enhanced throughout the semester. The ChatBot class will define a name field that identifies the chatbot (name … | |
How i can make my server receive data from certain client and send it to other certain one ? (Note : there is a lot of clients connected with that server) , that's alike private chat between two clients . | |
Here is the code for the programm. My question is why this statement in SudokuValidator doesn't work? [CODE]for (Cell[] myPuzzle : puzzle) {[/CODE] it gives me errors: [CODE] Exception in thread "main" java.lang.NullPointerException at SudokuValidator.isSolution(SudokuValidator.java:54) at SudokuValidator.main(SudokuValidator.java:27) [/CODE] [CODE]import java.util.*; public class Cell { int value; public Cell() {} // … | |
[CODE]import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Mortgage { private static double round(Double val) { // round the value to two decimal places int vala = (int) (val * 100); return (double) (vala / 100.00); } public static void main(String[] args) throws IOException { double loanAmount = 200000.00; // Loan … | |
[ICODE]System.out.println("Extra credit\nRe-enter number of seconds:"); int j = input.nextInt(); int i =(j/60); int k = (j%60); System.out.println(j+" seconds is " +i+" minutes and "+k+" seconds.");[/ICODE] Hi when i key in 30 for j the correct answer should be [COLOR="Red"]30seconds is 0minutes and 0seconds.[/COLOR] However my above code gives me 30seconds … | |
I am having trouble understanding how to set up the smtp property. I do not have internet connection now. I wanted to use my Outlook or something. What do I do to get Glassfish to generate emails so I can begin learning how to code my app to send emails … ![]() | |
i can not understand my Home work plz help me this is the Question ...... Problem 1. Write a program in which you will do the follwing: 1. Declare a two-dimensional array of double with 12 rows and 30 columns to store daily temperatures for one year assuming each month … | |
Hey I want to get the date and time with miliseconds in a format such as: 2012-02-09 12:41:52.982 or 2012-02-09 16:41:52.129 How can I do this in Java? (If I can get a localized version of "Tuesday" as "Tues" as well even better but if not, I dont mind. Something … | |
[CODE] private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: String sql="Select BADGE_NUMBER,FIRST_NAME from POLICE_TABLE"; try { Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance(); Connection con= (Connection) DriverManager.getConnection("jdbc:derby://localhost:1527/Traffic Ticket System","Administrator","admin1234"); /*As we are creating a connection on a local computer we will write the url as jdbc:mysql://localhost:3306 */ Statement stmt=con.createStatement(); ResultSet rs = … | |
help me plz The program does not sum the elements of the 2 matrix this my code [CODE]package javaapplication143; import java.util.*; public class JavaApplication143 { public static void ReadMatrix(int [][]a1 ){ int val=0; Scanner input=new Scanner(System.in); System.out.println("Enter 3 rows and 3 Columns for matrix 1 "); for(int i=0 ; i … | |
Hello, Can anyone pls help me out with this code, its the server portion of the client server program..i have downloaded it from net [code=java] Socket s,s1,s2; ArrayList al=new ArrayList(); ArrayList al1=new ArrayList(); ArrayList al2=new ArrayList(); ArrayList alname=new ArrayList(); MyServer()throws IOException{ ServerSocket ss=new ServerSocket(10004); while(true){ s=ss.accept(); s1=ss.accept(); s2=ss.accept(); al.add(s); al1.add(s1); … | |
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 … | |
If I have a loop of dropdowns that have the name "options[123]" where the bracketed number will change, is there a way to pull all the available dropdowns with a name that starts with "options" and then loop through them to make sure at least one is selected... <0 | |
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] |
The End.