Java/Questions Answered by Expert Brian Ngure

SubjectDate Asked
Form submission to j_security_check1/30/2012
  Q: I came across a login form in jsp as follows, <form method="post" name="login" ...
  A: The special resource "j_security_check" used in the action attribute of the form is a special ...
Threads1/23/2012
  Q: I want to print the numbers form 1 to 100. Here i want to use two threads, one thread prints only ...
  A: Could you put your code up here and I can help you out. Basically, you should write the code for ...
JAVA ARRAY1/15/2012
  Q: good morning sir.... actually i tried to find a value from array in java... if suppose searching ...
  A: You need to edit the actionPerformed method. 1. You were creating the MySQL connection but not ...
JTable Searching with highlight1/10/2012
  Q: I have already searched for similar threads but with no results helping me I want to make the text ...
  A: Are you sure you want to highlight as opposed to filter out the extraneous results? If you highlight ...
JAVA ARRAY1/9/2012
  Q: good morning sir.... actually i tried to find a value from array in java... if suppose searching ...
  A: You get a java.lang.StackOverflowError. This basically means that your program is running out of ...
Java with Oracle12/31/2011
  Q: import java.sql.*; class Kettavan { private Connection conn; private Statement stmt; ...
  A: Some things to try: 1. Check that the host name is correct in the listener.ora and tnsnames.ora ...
java & oracle12/29/2011
  Q: i tried most websites methods to connect java with oracle but cant... shall u guide me from the ...
  A: Try this. Let me know if it throws an error. import java.sql.*; class Kettavan { private ...
java & oracle12/27/2011
  Q: i tried most websites methods to connect java with oracle but cant... shall u guide me from the ...
  A: To connect to an ORACLE database, make sure you have the Oracle DB driver jar file in your path. ...
servlet12/27/2011
  Q: i am starting java programming and i want to do web programming but i dont know what should i ...
  A: A servlet is a server side Java program that runs inside an application server like Tomcat or ...
Storing values for variables When closing12/5/2011
  Q: Hai,I want to know how to store a value for a variable when we exit from a java programe.I mean like ...
  A: You would have to store the value of the counter in a permanent storage on disk. You can do this in ...
java12/3/2011
  Q: i am planning to build a mail server which is used in a local area network.it have to login ...
  A: There is no need for you to go and re-invent the wheel. There are a number of free mail servers ...
Package does not exist error12/1/2011
  Q: i have installed the jdk1.7.0_01. This is the path : C:\program files\java\jdk1.7.0_01\bin i create ...
  A: I would advise you to read the Java documentation or Java tutorial section on paths and packages. ...
Comparing Docx Files11/16/2011
  Q: I want to compare the content of 2 docx files using Java code. I have tried coupe of options using ...
  A: You would probably do better using the docx4j library: http://www.docx4java.org/trac/docx4j There ...
platform independent11/4/2011
  Q: Can u please clear the meaning of platform independent. As java is platform independent what is the ...
  A: Java being platform independent means that you should be able to the write the code once (on any ...
deploy war into Tomcat5/22/2011
  Q: I want to realize a wizard that installs my web application (*.war), but I don t know how to deploy ...
  A: You don't need a wizard to deploy WAR files. Deployment is as simple as copying the war file to your ...
A computer mystery1/17/2011
  Q: Brian Hope you've been doing well. Ever since I've purchased a new wireless Microsoft mouse for my ...
  A: Your problem sounds like a hardware error. Can you try get updated drives for the mouse? Also, ...
Utilization exceed 100%10/22/2010
  Q: Can you help me please in the following: I used Java to implement server/client approach I have one ...
  A: Perhaps you could use the ExponentialGenerator class: ...
Attendace: I can't find the answer10/22/2010
  Q: Sir, I cannot find the answer that you gave for the following problem. Can you help me out? I am a ...
  A: Using an example from one the links I sent you, you would need to store the attendance information ...
HitTing the URL With some parameters10/22/2010
  Q: I have a URL with some parameters ...
  A: You could use curl java located at: http://curl.haxx.se/libcurl/java/ But here is a basic example. ...
Java in Office10/21/2010
  Q: I am a beginner, and I need help immediately. Being the manager of an office, I need to maintain ...
  A: In order to retain the value of attendance, you will need to store the last value in either a text ...
java program(netbeans)6/14/2010
  Q: Your Open QuestionShow me another » Java application help? write an application that propmts for ...
  A: You need to read the users name e.g. // Prompt the user to enter their name (do the same for name2) ...
To retrive data from database and print them to text area in new line3/11/2010
  Q: i want to print the data from database to my text area in java swing i get the output but it comes ...
  A: Try this: try { //ResultSet rs = null; pstatement = con.prepareStatement("SELECT ...
Help me3/10/2010
  Q: Sir, I'm doing Master of computer application(MCA) final year project. I have choosen a project ...
  A: I have not done anything like this before, but I expect you will have to make extensive use of SNMP. ...
Could not find main class3/7/2010
  Q: I have a problem in opening a .jar file I am currently using Netbeans IDE and I had created a ...
  A: There could be a number of reasons. Try the following: 1. Make sure that the JAR file has a ...
computer3/7/2010
  Q: what will happen if we do not use the break statement at the end of each case block of switch case ...
  A: If there is no break, then the code in all of the cases after the selected on will be executed. ...
Java titleCase String Tokenizer3/3/2010
  Q: I really need help! Im currently studying Java programming in college and really stuck with this ...
  A: Try this: public class Capital { /* * This program will print a copy of the line in which ...
running applet1/27/2010
  Q: I have an applet witch cantons following code : System.setProperty("proxySet", "true"); ... I set ...
  A: It seems like your security policy file is either not being read or is incorrect when running from ...
writing a method1/23/2010
  Q: i have been trying to write this method for moving a queen on a chess board but i can't get it. if ...
  A: You should not use commas in an if..else statement. Try this: if (((fromrow < 0) || (fromrow > 7)) ...
filing in java1/21/2010
  Q: i have some text in urdu language in abc.txt file i want to save it on the string in the console ...
  A: Have a look at these examples: http://www.java2s.com/Code/Java/I18N/Encoding.htm Also see: ...
filing in java1/20/2010
  Q: i have some text in urdu language in abc.txt file i want to save it on the string in the console ...
  A: Assuming that you have done everything correctly in Java like specifying the language preferences ...
Creating a Custom Filename Extension in JAVA1/19/2010
  Q: AS part of the final year engineering project, I am developing a PDF reader and there are some extra ...
  A: To save a document with a different extension, you just need to specify the extension you want. You ...
Java Query1/15/2010
  Q: Please tell me the output of the following program written in Java! class a{ public static void ...
  A: In order to follow the program step-by-step, I suggest you use an IDE like Netbeans which you can ...
Use of regular expression in java1/14/2010
  Q: How is check the date using regular Expression..and also i want to check that the date is not exceed ...
  A: Have a look at these two: import java.util.regex.Matcher; import java.util.regex.Pattern; ...
java1/14/2010
  Q: Could you help me with this question ,it's going to be for my exam or something like this!!! I need ...
  A: a) Both i and j are positive. if ((i >= 0) && (j >= 0)) // If you consider 0 to be a positive ...
Image Decryption Problem1/11/2010
  Q: Plzzz check my code and tell me what happen if i encrypt file it shows image no preview avialable ...
  A: It does work. You just have to write a little code: //Encrypt file: import ...
JAVA1/10/2010
  Q: Sir, Belated Happy New Year Wishes. Will You Please mail me the difference between PrintStream & ...
  A: A look at the Java documentation will answer your question. I quote: PrintStream extends ...
Java Help1/8/2010
  Q: I have been learning Java Programming briefly for a little less then a month. I have learned to ...
  A: Methods have parenthesis after them e.g. prime(), sometimes with variable parameters e.g. prime(int ...
CODE for the question I asked previously9/10/2009
  Q: import javax.swing.JOptionPane; public class Assign2 { // main method begins execution of Java ...
  A: Because you are using do {...} while, the code inside do will run at least once no matter what ...
Solution for a Java problem9/10/2009
  Q: Sir, I have read an excel file using java.I stored all the cell contents in a string array.One ...
  A: I'm not sure exactly what the problem is. To move to the next cell, you just need to call ...
LinkedList9/8/2009
  Q: Brian, Hopefully you can answer my question, as Google has failed me! :) I'm using a LinkedList as ...
  A: Sorry, but I have not been able to find any reason why this is happening. I have had a look at the ...
swap 2 numbers9/3/2009
  Q: I wanna simple java code to swap 2 numbers without using 3rd variable and these 2 numbers should be ...
  A: Here is a simple example of how to get keyboard input: import java.io.*; public class TestReadLine ...
Java Questions9/2/2009
  Q: Hey, I'm a Java newbie and I just ran into some confusing programs without explanation, can you help ...
  A: It's not easy to find out where objects exist in memory in Java. In C or C++ you have pointers. ...
Java Questions9/1/2009
  Q: Hey, I'm a Java newbie and I just ran into some confusing programs without explanation, can you help ...
  A: 1) Yes. Automatically false. 2) Put a space between the time and PM 3) Different objects because ...
java2/18/2009
  Q: I want to get a sample java software for medical diagnosis of heart disease of data mining(decision ...
  A: The main thing you need to do is research. Don't re-invent the wheel. Look for code, libraries, etc ...
system calls specific to OS2/16/2009
  Q: hai again I read that the java functions will be eventually calls to the native OS. So I unzipped ...
  A: I am glad that you are looking into Java this far. Most people do not. The system calls are normally ...
Java2/13/2009
  Q: I'm not sure if this is in your field but seen as you know Java maybe you could help. I'm trying ...
  A: Sorry, can't help you there. It sounds like the operating system has become corrupted somehow. Maybe ...
Java2/13/2009
  Q: I'm not sure if this is in your field but seen as you know Java maybe you could help. I'm trying ...
  A: In that case, it sounds like you might be having hard disk problems. Any weird noises from your hard ...
Java2/12/2009
  Q: I'm not sure if this is in your field but seen as you know Java maybe you could help. I'm trying ...
  A: Could you give me some information? Anything in the Event logs? Is there a specific error message ...
trimToSize() method2/5/2009
  Q: I am making an array of objects. I will not paste all my code, my methods are working except for ...
  A: The objects array will not be modified in ths method. Try create a new objects array and return it. ...
Array of Objects2/2/2009
  Q: Let me first tell you that I'm new to Java :) I'm trying to make an array of objects with 3 ...
  A: MyArray() This simply creates ablank new MyArray object with nothing in it. e.g. MyArray arr = new ...
Simple Java10/27/2008
  Q: Please tell me why this program won't print out the sweets passed in on the command line. Obviously ...
  A: You have forgotten to make the main(String[] args) method static. Also, you should use the equals() ...
limewire+java+usb10/26/2008
  Q: I have made a portable limewire pro version 18.8 i have put it on my usb (and also installed another ...
  A: Check to see if limewire has a configuration file (a text file of some sort). If it does, see if ...
Creating a palindrome program10/20/2008
  Q: I'm trying to create a program that can do the following...prompt and get a forward string and check ...
  A: Please have a look at the following three examples of writing palindrome code. Pick the one that ...
thread10/20/2008
  Q: i have to do assignment base on java thread. so i need 2 develop a little game using this.i only ...
  A: Here are two links on Thread tutorials. Very simple 5 minute read. ...
write a program to calculates and prints....(please help)10/18/2008
  Q: Write a program to calculates and prints the monthly paycheck for an employee.The net pay is ...
  A: You need to get the user input twice, using two separate JOptionPanes. Once for the amount and once ...
Getting NoClassDefFoundError in simple program10/16/2008
  Q: Here's my super simple program: //Code start public class hello{ public hello(){ } public ...
  A: You need to add Java to your classpath. Do this: Right click "My Computer" -> Properties -> -> ...
JFileChooser + DES File encryption10/15/2008
  Q: I am designing an Encryption & Decryption application, the problem is that the source code that I ...
  A: You need to use one or the other. Either use: public static void openFile() { File file = ...
Program I am trying to write10/15/2008
  Q: I have to add narration to a transport method in a agent class that involves a figure moving from ...
  A: You could assign "small room" and "big room" to variables and interchange them based on which ...
Java and swf file10/15/2008
  Q: .. i would like to ask if is it possible to import swf file or any macromedia flash file to your ...
  A: I have not done this before, but please have a look at this link for a howto: ...
Username & Password10/14/2008
  Q: I am trying to create a script that would allow users of a website to create a username and ...
  A: Please ask your question in the JavaScript forum. This forum is for Java questions. Here is a link ...
Minesweeper using Java10/12/2008
  Q: I'm doing a on a program like that of the minesweeper and I'm now having trouble on uncovering the ...
  A: It may not be running properly because some of the graphics (images) are missing. Just double check ...
JFileChooser + DES File encryption10/12/2008
  Q: I am designing an Encryption & Decryption application, the problem is that the source code that I ...
  A: To use a JFileChooser, try something like this: JFileChooser chooser = new JFileChooser(); public ...
project idea10/10/2008
  Q: we have decided to implement the following scenario as our final year project.... tell whether it is ...
  A: Yes it is feasible, but you will have to use external libraries such as the iText library for PDF ...
Bit Operation in JAVA10/10/2008
  Q: int newRed = (0xff000000 | (0xc0 << 16) | (0x00 << 8) | 0x00). This line of code is ...
  A: The hex values are how numbers are calculated for colours in the RGB format. ff = 255 c0 = 192 00 = ...
FirePropertyChange10/6/2008
  Q: .. i would like to ask 1. what is the importance of firePropertyChange and the ...
  A: You would use these when you want to check if an object, e.g. a textfield has changed its ...
Exporting table results to excel10/3/2008
  Q: I have an ArrayList with results that I export to excel like so: package ...
  A: When adding the titles, try specifiying the format at that time. e.g. s.addCell(new Label(0, 0, ...
loading images in java10/3/2008
  Q: Brian Probably the subject says it all. How can I load a .JPEG image in java?? Just the simplest ...
  A: This is just about the simplest method: ...
JTable and JExcell10/3/2008
  Q: .. I'm new in using JTable and JXL... but i just want to know or if its not too much i would like to ...
  A: All the information you need is there together with some examples. The download also has all the API ...
set textfield with database values..10/2/2008
  Q: i created the swing table that retrieve values from database and display that values.if i select ...
  A: Your problem is becoming clearer to me. You need to get the row number that was clicked in the ...
SWING programming-display window at center10/2/2008
  Q: i have created a window that has menu item.when i click that menu item, new window is opened..i want ...
  A: Try this: /** * Centers the target component on the screen. * <p> * @param ...
Minesweeper using Java10/2/2008
  Q: I'm doing a on a program like that of the minesweeper and I'm now having trouble on uncovering the ...
  A: 1. You can use a javax.swing.JFormattedTextField with a java.text.NumberFormat as the format. ...
swing textarea10/1/2008
  Q: how to retrieve data from mysql database and display that data in text area?pls let me know with ...
  A: Try something like this: String query = "SELECT name1, name2 FROM table1"; PreparedStatement stmt ...
accept value from a table10/1/2008
  Q: i want to select a row form a table and assign the fields of the table to text fields.i created the ...
  A: If by first row you mean only the column headers, try this: private void ...
swing9/30/2008
  Q: i want to retrieve data from swing table (not from database)table and it should be displayed in ...
  A: See the previous answer: if (e.getActionCommand() == "SELECT") { try { ...
accept value from a table9/29/2008
  Q: i want to select a row form a table and assign the fields of the table to text fields.i created the ...
  A: Try this: private void patientidfieldActionPerformed(java.awt.event.ActionEvent evt) { ...
java.awt.toolkit error in ubuntu9/26/2008
  Q: im using Ubuntu as my Operating System n netbeans IDE6.0 for creating java application.. when i try ...
  A: That's the right Java to use. You might try setting your classpath and checking if an alternate Java ...
Minesweeper using Java9/26/2008
  Q: I'm doing a on a program like that of the minesweeper and I'm now having trouble on uncovering the ...
  A: You must have the locations of the mines stored somewhere in an array, vector or hashtable. What you ...
edit existing excel file using JXL in java9/25/2008
  Q: .. im just a newbie when it comes to programming in java... but im really interesting and would ...
  A: The problem might be in the Maths. Remember, division in Java is complicated. You need to use the ...
edit existing excel file using JXL in java9/24/2008
  Q: .. im just a newbie when it comes to programming in java... but im really interesting and would ...
  A: Have you had a look at the tutorial http://www.andykhan.com/jexcelapi/tutorial.html All the ...
showing jframe9/23/2008
  Q: i want to ask again..I create a mainform using jframe.I set the width and the height according the ...
  A: With JOptionPane, the first argument is for the owner of the option pane. Do not leave it null, but ...
need help9/22/2008
  Q: i want to ask.I got code like this,i want to ask how to make the program display error message if ...
  A: Try this: try { Class.forName("com.mysql.jdbc.Driver"); String URL = ...
Java help please9/21/2008
  Q: I am writing a program for my programming class where we have to write a program that determines the ...
  A: Please see my example to work it out: For example, 31 % 9 results in 4 because 9 goes into 31 three ...
Java help please9/21/2008
  Q: I am writing a program for my programming class where we have to write a program that determines the ...
  A: You need to read up on the modulus operator (%). Division in Java only gives you whole numbers, not ...
need help9/21/2008
  Q: i can't use the follow up..It says to much..The txtPwd.setfocusable(true) is the remains of the ...
  A: You could pass the string in the constructor of the new JFrame: public NewJFrame(String user) { } ...
Java SDK getting Started9/18/2008
  Q: I work in technical support and am just trying to learn something about coding. I downloaded ...
  A: Try this. System variables are usually all caps, so: 1. ANT_HOME=C:\Ant 2. JAVA_HOME=C:\JDK 3. ...
need help9/18/2008
  Q: i can't use the follow up..It says to much..The txtPwd.setfocusable(true) is the remains of the ...
  A: To move to the password field after pressing enter in the user name field, you need to check which ...
cannot directly filling the jpasswordfield9/17/2008
  Q: i want to ask again..I've created a login form,my problem is that when i run the project,i can't ...
  A: On Ubuntu, sometimes with text or password fields, I have noticed that you need to middle click ...
Question on Nested Classes and JSP?9/16/2008
  Q: I have two questions one on Java Nested classes and the other on JSP i am preparing for java ...
  A: Try this code for nested classes: public class NestExample { public static void main(String ...
need help9/12/2008
  Q: i need help.I've created a jdialog for login form and a jframe for the main app by using netbeans ...
  A: To do this should be more or less the reverse of what you do to display the main form. In your ...
Designing in JFrame9/7/2008
  Q: I developed one encryption software in Netbeans IDE 6.0(JAVA) with use of JFrame. Now i want to make ...
  A: You need to extend JFrame. Something like this: import java.awt.BorderLayout; import ...
jdbc9/5/2008
  Q: Brian i would like to insert into my database a date in the format DD-MON-YYYY so far, i have the ...
  A: You need to do something like this: try { stmt = conn.prepareStatement("INSERT INTO ...
creating an object from Class variable9/4/2008
  Q: Brian I have the following code inside my main method /* code begins here Class personclass = ...
  A: Remember that you need to use the fully qualified name of the desired class in forName() e.g. ...
java8/28/2008
  Q: I am shukle parnash from Gujarat in India. I am student of MCA(Master In Computer Application) I ...
  A: To make a JAR file executable, you need to specify the main class of the application in the ...
Double value Handling in java8/26/2008
  Q: I am getting a Value from query as "53310588.75" as String. When i convert into double value using ...
  A: You need to use the NumberFormat and DecimalFormat classes to format the number the way you want. ...
abstract classes and concrete classes8/26/2008
  Q: let's say i create a subclass derived from another abstract class let's say i only wanted to use a ...
  A: You must include the other abstract methods. You do not need to implement them, you could leave them ...
set CLASSPATH and packages8/25/2008
  Q: brian i'm learning about packages in java i dont get the purpose of set CLASSPATH what is its ...
  A: You normally set the classpath so that the the Java compiler and interpreter can find and run ...
JFileChooser8/18/2008
  Q: i'm trying to make an application that read a .txt file from HDD,i created a button "open" so when i ...
  A: To find out how to use JFileChooser, please have a look at the following link. ...
JFileChooser8/15/2008
  Q: i'm trying to make an application that read a .txt file from HDD,i created a button "open" so when i ...
  A: I would suggest you look at some of the free libaries available that can read and write to/from CSV ...
JAVA8/13/2008
  Q: What is Java and its purpose ??? I can't remember why I down loaded it, and to this day I have ...
  A: Java is software used to run various programs. For example, some online chat programs use Java ...
HashMap vs Hashtable8/13/2008
  Q: What Hashtable does not allow null in both key and value, where as HashMap does? ANSWER: Hi, Not ...
  A: As any software evolves, new features are added. The ability to have null values was added in a ...
reading a single char in java8/13/2008
  Q: Brian I just want to know how to read a single char from the keyboard in java thanks
  A: import java.io.*; /** *This class demonstrates how to read a line of text from the keyboard. */ ...
Java program design8/12/2008
  Q: I'm new to java and decided I'd try my first program that involved abstracting my program into ...
  A: Unchecked or unsafe operations simply means that you should specify the type of elements that you ...
public, private and protected8/12/2008
  Q: Our professor in computer science asked us the symbols used by public, private and protected when ...
  A: I suppose it would depend on the IDE a person was using, but generally, public methods have a simple ...
HashMap vs Hashtable8/11/2008
  Q: What Hashtable does not allow null in both key and value, where as HashMap does?
  A: Not really sure what your question is. However, both provide key-value access to data. The Hashtable ...
JSP8/9/2008
  Q: I want to know that how I can put Rsultset value of a column in Input Value to be read in next JSP ...
  A: You would need to use a session to store the ResultSet value. Something like: HttpSession session = ...
Convert a for loop to while loop8/8/2008
  Q: I do not know how to convert a for loop to a while loop. I'm lost!! Here is the code. import ...
  A: Here is the code using a while loop. import javax.swing.JOptionPane; public class ForLoop { ...
can we hyperlink a pdf file and a ppt in java?8/2/2008
  Q: sir, i am building a software , am not using netbeansa or any other ide, rather am coding in the ...
  A: You could create a mouselistener on a JLabel, clicking on which the pdf file should open. For ...
java warning message8/2/2008
  Q: Brain I use the LinkedList class from java.util.* package in order to create a list of objects but ...
  A: This "warning" comes about because of generics. The code should should work fine. If you don't want ...
Enquiry about Text on Java5/9/2008
  Q: .. I have the following trouble If I have a text file (.txt) like this: "II. VARIACION DE LAS ...
  A: You nned to read the file into a String. You can then call the setContent method with that string. ...
java install5/8/2008
  Q: I love to play pogo, but I sometimes get a message that the applet is corrupt, I've done everything ...
  A: What you could try is renaming the existing the Java installation directory and then installing a ...
Enquiry about Text on Java5/5/2008
  Q: .. I have the following trouble If I have a text file (.txt) like this: "II. VARIACION DE LAS ...
  A: Basically you need to split the original string into component parts. You can split on a specific ...
Java applets not loading5/1/2008
  Q: I have been unable to do my taxes online this year because of an error I get continously-java ...
  A: You could be getting the error for a number of reasons. It could be the browser version, the Java ...
java help4/30/2008
  Q: Im a beginner in java,Im stuck with my assignments, pls help me? I have to 1) Write a program to ...
  A: You are going in the right direction. You have so far basically done part 1 and part 2 (Display all ...
hey. Computer Science wants to KILL me4/29/2008
  Q: i am a first year and doing Comp sci as my major. We doing Java and we have been asked to develop a ...
  A: As I stated, the LCM is calculated by: LCM = (a * b) / gcd(a, b); You get the gcd from the ...
syllable the words4/29/2008
  Q: i want to make program in java (eclips)which can syllable the words...yeah it should separate in ...
  A: 1. You are not very clear about you want. 2. This looks like like homework. 3. Here are a couple of ...
the use of text files4/24/2008
  Q: This is a question i waz given by my computer science lecture and i dont have an idea how to ...
  A: Load the dictionary into something like an array inside the spellchecker class. You can then check ...
netbeans 5.5.114/24/2008
  Q: can ||(or) condition be used in netbeans with the if statement? and can u please send me the code ...
  A: Yes you can use || (OR) in an if statement. e.g. [Pseudo code] if(booleanCondition1 || ...
splitting an image4/23/2008
  Q: am marla from brunei. Basically, am a student in computing and currently am doing jigsaw puzzle ...
  A: Here is some sample code: ---------------------------------------- import java.applet.Applet; ...
netbeans 5.5.14/22/2008
  Q: how to move from one frame to the other on the click of a button?
  A: If you mean make the other frame the selected (active) frame, try this inside the actionPerformed ...
netbeans 5.5.14/22/2008
  Q: how to access the data entered in JTextField of 1 frame into the JTextField of other frame.please ...
  A: There are a number of ways you could go about this. 1. Make the JTextField of frame 2 static the ...
java rmi4/21/2008
  Q: im writing a chat program using java rmi client server base. mmm why do i need a two way rmi? ie why ...
  A: It is possible to make the client program act as a server, but most chat programs have the client ...
packages4/18/2008
  Q: the following program is not compiling can u tell me why?package com.perfect.ecommerce; import ...
  A: The error you are getting simply means that the file name should be called Item.java However, when ...
matrix multiplication4/18/2008
  Q: i have the following question how can i multiply 2 matrices? the rules are the following (assume ...
  A: Try something like this: MatrixFunc.java (matrix multiply code). ReadMatrix.java (read matrices ...
Problem in displaying tables from a web page4/18/2008
  Q: amazon.com and I would like to extract the tables in that particular web page would somebody out ...
  A: You could search for nested tags. Here's how: Assume that the final string you have has two tables, ...
Screen saver custom text4/17/2008
  Q: Brian. Why can I only put no more than 20 words on my computer screen saver to see? Is it possible ...
  A: As far as I can see, you are limited to 20 characters because the 3D text must be able to display ...
java portable4/17/2008
  Q: I am playing chess in the internet and for that i require java. I have a computer at school that ...
  A: You could try copying the JDK or JRE folder onto your USB and starting the program by pointing to ...
Problem in displaying tables from a web page4/14/2008
  Q: amazon.com and I would like to extract the tables in that particular web page would somebody out ...
  A: Just search each line of input for the table open and close tags. Then store the tables in a ...
java code using netbeans 6.04/13/2008
  Q: i am make application in swing component. In tht I have One form where i want add a tree left side ...
  A: You need to override the default options entered for the JTree with your own. Please see: ...
coding question4/12/2008
  Q: I hope you can help me! I'm creating a website for a friend's company and I ran into an issue with ...
  A: I don't really find anything wrong with your coding. You might want to try indenting you code though ...
Java Program4/11/2008
  Q: I have to create a method called create palette that creates a digital method that is a color ...
  A: private Palette createPalette(Object info) { // Create colour palette here ... return ...
having Problem in inserting values from HTML into Database through JSP4/11/2008
  Q: i m a student working on a project Visitor Gatepass System.I have to insert values in Databse ...
  A: Please see my other answer. For a quick tutorial on JSP's please see: ...
connectivity of html with database4/9/2008
  Q: i m a student working on a project Visitor Gatepass System.I have to insert values in Databse ...
  A: To input values from a web page you will need to use a JSP page and possibly a servlet to process ...
iframe zooming4/8/2008
  Q: I have six jsp pages displayed on a single html page by using iframes. I want that if user clicks on ...
  A: Not really sure if this will help you, but I've seen it in a couple of forums: // In the head tags ...
Dice Simulation4/5/2008
  Q: My programming teacher gave me thisWrite a program that will simulate the result of throwing of a ...
  A: Generating the numbers is simple: [Pseudo-code] int x = (int) (Math.random() * 10); // Trim ...
read a word file and parse for a number using java4/4/2008
  Q: I have to open a word file, parse it for a number which is located mostly 3rd or 4th line from last, ...
  A: There are a number of libraries available to parse Microsoft document formats. Have a look at these ...
java code using netbeans 6.04/3/2008
  Q: i am make application in swing component. In tht I have One form where i want add a tree left side ...
  A: Sorry for the delay answering. To add a tree, select a new JTree from the palette menu on the right ...
J2EE3/3/2008
  Q: I m displaying records on JSP page. and also check box with each record. For deleteing Cheked record ...
  A: I made a JSP page that did something like this: 1. Using a StringBuilder, I created the checkboxes ...
New line in Lotus Notes document3/2/2008
  Q: I already asked Neil for this but Im trying evething I can. Our previous chat about my problem is ...
  A: I have not personally used Lotus Notes. From what I have seen in the little documentation I could ...
Exel access through java12/13/2007
  Q: i am developing a java app, where i need to use Excel as the database. the difficulty that i facing ...
  A: There are a number of libraries available to read/write to excel. Have a look at: ...
recieving double or float input from console12/11/2007
  Q: ive been working on this easy program forever it seems i just converted from Qbasic and im a bit ...
  A: Sorry for the delay in answering. Yes, you can use the BufferedReader to read doubles. Try something ...
java12/4/2007
  Q: Can scan all the roots (drives like A:, C:,E:c). Asks (by command line) which roots not to scan ...
  A: Most of what you are looking for is available from the JDK API documentation. e.g. java.io.File has ...
stroring arabic data keyed in by user12/3/2007
  Q: Sir, System Specifications: 1.J2EE-AppServer - Pramati4.1 2. DataBaseServer - MSSql 2005 3. ...
  A: It looks like you have checked all the places I would look for the problem. Have you checked the ...
Java maze12/2/2007
  Q: I'm having a hard time trying to create a maze that randomly generates path and walls. All I know is ...
  A: Here are some links where you can find examples of how you would go about doing this: ...
Java11/28/2007
  Q: I wrote a program to read palindromes but I want it to ignore spaces, capitalizations, and ...
  A: You should covert the string either to upper case or lower case first and then strip all characters ...
Installing Java on HP/Compaq Windows Vista Home Premium11/27/2007
  Q: I just bought this computer and I have been trying for days to download Java. I can't access things ...
  A: My advice is to first stop using internet explorer as your primary web browser. Go to www.opera.com ...
objects in hashset11/26/2007
  Q: How do I use HashSet in this problem: I have a class Word: public class Word{ private String ...
  A: I think what you are after is getting the word "banana" printed out. To do this, you can't use ...
please help me11/22/2007
  Q: what is the delimeter needed to search using Scanner for the first name of this data: Magdy, pop, ...
  A: You could either use: \b A word boundary or \S A non-whitespace character: [^\s] or \W A ...
how to start my project11/21/2007
  Q: iam abt to start my project which is a part of my academics n i have an little knowledge abt Java n ...
  A: Having all those features will be a lot of work. Take for example Google, who took months to get ...
Arraylist11/19/2007
  Q: I am very confuse about the arraylist and I would like to check with you guy with my understanding ...
  A: Correct to the first two. As for number three, it is recommended that you use generics and declare ...
Needing help solving a Java problem11/15/2007
  Q: I'd like to know how to Write a class Palindrome (), that accepts a string and confirms or denies ...
  A: Try something like this: // This method returns 'true' if the parameter // is a palindrome, a ...
extracting portion of text sing java11/14/2007
  Q: I wish to know how java can be used to extract part of a text file. The situation is like this: I ...
  A: Look for the starting and ending word positions using the String method indexOf(). e.g. int start ...
connect algorithm11/13/2007
  Q: How are you? I'd like to ask for your opinion regarding a programming obstacle I have. I have a ...
  A: I would do basically what you have done. However, arrays are known to be slow. Try using an ...
jtextfield11/10/2007
  Q: sir,please help me with this: how to read text from a jtextfield and store i into a datafile? ...
  A: Sorry for the delay in answering. Overloaded at work. Try something like this: 1. Instanciate the ...
jtextfield11/9/2007
  Q: sir,please help me with this: how to read text from a jtextfield and store i into a datafile? ...
  A: To get the text from a JTextField do this: String text = jTextField.getText(); What do you mean by ...
puzzle11/8/2007
  Q: I mean, based on my code how to display the final stage 3x3 array to graphic? and can u help me to ...
  A: To display graphics you could use a pre built library such as JGoodies Animations ...
question11/8/2007
  Q: u can access the private data out side of the class directly upto j2sdk1.4 but from jdk1.5 onwards ...
  A: As long as a variable is maked as private, it is only accessible to members/methods in its own ...
puzzle11/6/2007
  Q: can u tell me why this code cannot work?? it said cannot find symbol. can u tell me what the ...
  A: Your problem is that you are calling the Puzzle constructor that has no arguments (which does not ...
parse tree11/1/2007
  Q: i m writing program for parsing a sentence which output will be a parse tree......i have completed ...
  A: I don't know of any libraries that can easily help you do this. You may just have to use some of the ...
java10/29/2007
  Q: we use JOptionPane.showMessageDialog( null, result, “Comparison Result”, ...
  A: As stated in the Java API, the first parameter: "parentComponent - determines the Frame in which ...
File10/26/2007
  Q: I've visited some pages on File, but the difference between File and some contents like ...
  A: The answer is there in the Java API. File: An abstract representation of file and directory ...
JAVA10/25/2007
  Q: I am working on fixing a website for my organization. Someone started and never finished the ...
  A: The problem is that the flash file "http://www.trentonems.com/logo.swf" cannot be found. Try copying ...
java10/22/2007
  Q: now i can use the private function, do you thinks this code is right, any logic error? and i still ...
  A: The program looks ok. To print out the locations try this: public class Test { private boolean ...
java10/21/2007
  Q: i am going to make a simple DFS, from the coding below, is it right? and can u help me if i want to ...
  A: Sorry but I'm not clear on what you need. Does this help? public class Test { public static void ...
bout java class10/20/2007
  Q: Im a beginner to JAVA language and im using Netbeans 5.0(mobility),i had difficulty on how to make a ...
  A: Create your new class in Netbeans using the wizard. Specify the package, class name, etc. Then, in ...
Beginnner question10/17/2007
  Q: I am a .NET guy and quite a good experience in .NET. I am planning to learn Java and want to have a ...
  A: In a perfect situation, things like form design, etc would be handled by a design department, ...
bout java 3d api9/28/2007
  Q: im a beginner to java mobile and im using netbeans as my IDE ,im having difficulty of what JSR(184) ...
  A: The JSR 184 is a specification document that outlines guidelines and practices to be followed during ...
Void Function9/26/2007
  Q: Hey Brian, I am just beginning to learn Java and was wondering how you would go about doing the ...
  A: It would help if you could post the code you have written so far. Here is an example. private int ...
abt to start a project9/25/2007
  Q: sir i am abt to start my work upon a project which serves as a part of my college curriculam. but i ...
  A: Projects are never easy and you have little time to do one in. You should have allowed at least six ...
Two-dimensional arrays9/24/2007
  Q: I'm trying to solve a problem and apparantely I can't think of a solution for one of the issues. I ...
  A: Say for example your matrix has numbers from 1 to 50. Get 10 random numbers using (Math.random() * ...
Two-dimensional arrays9/24/2007
  Q: I'm trying to solve a problem and apparantely I can't think of a solution for one of the issues. I ...
  A: Here are some examples. // Get the number value (based on the loops) // and then convert // From ...
using Java to control client side h/w9/20/2007
  Q: i hav a problem ..... how can i use jav code to control the h/w that is kept on the client ...
  A: I don't think you can control hardware remotely, at least not easily. You would have to do some ...
getch() in java9/12/2007
  Q: "please could you tell me how to replace the c instruction getch() with something else in Java but ...
  A: There isn't a way. You can't count on every platform to support such. Some just have line mode ...
Basic Lingo game return9/7/2007
  Q: Hey! Thanks for the reply. I started working on that basic lingo game problem that I had sent a ...
  A: Perhaps you could use a temporary file to store the string using createTempFile(String prefix, ...
Java not working9/7/2007
  Q: I have the Java JSE runtime environment loaded in my programs. It does not initiate on its own or ...
  A: Sorry for the delay in answering. It sounds like something has corrupted your files. Try deleting ...
Convert File data to Byte variable9/6/2007
  Q: I define variable as File like File dt = new File("enyrt.data"); then FileInputStream fis = new ...
  A: Try this: try { File dt = new File("enyrt.data"); FileInputStream fis = new ...
null character9/1/2007
  Q: if the user enter a null character i want print a message invalid command, but i wrote some code for ...
  A: Try the following code. { System.out.println("Choose M to print main Menu"); choice = ...
Upload the existing issue8/31/2007
  Q: I am working on a web application. I have a some issues regarding particular equipments. When the ...
  A: Use session tracking. Store each issue in some form of session tracking (cookie, etc). Then when you ...
Questions on ObjectOutputStream.PutFields8/31/2007
  Q: saw the earlier answer of this subject but my code here still hit the same error: private static ...
  A: The java.io.NotActiveException is thrown when a classes writeObject method was not called to write ...
Basic Lingo Game8/30/2007
  Q: Rules Lingo™ is a popular game show on the Game Show Network, with simple rules. Players are given ...
  A: This looks like a homework question. This a fairly long project which would require me to spend a ...
Write into csv file8/29/2007
  Q: I want to write some data into a csv file fetched from the database using java. Can you please help ...
  A: There are many free java libraries that you can use to write to CSV. One of these is the Ostermiller ...
bit representation8/26/2007
  Q: PLease can you give me a detailed explanation about why range of byte datatype is -128 to 127. Since ...
  A: All primitive types in Java are signed meaning they can be negative and positive. For bytes, there ...
extract data from access database4/23/2007
  Q: How to extract data from Access Database and create a yahoo account. The code needs to be written in ...
  A: I have never done anything like this, but here is a very good library you can use to get data from ...
gui vs logger question4/16/2007
  Q: I have a java app that has a GUI with a java.awt.textbox where I log steps of the application. This ...
  A: What you could do is include the code to write to the logger in the method that writes to the GUI. ...
filtering4/16/2007
  Q: i need some help. now i'm develop a monitoring system with java. i want make a filtering to user ...
  A: You should dispose of the PreparedStatement, ResultSet and if necessary the Connection by setting ...
gui vs logger question4/13/2007
  Q: I have a java app that has a GUI with a java.awt.textbox where I log steps of the application. This ...
  A: Your code is not too bad. It should write error messages to the text area. You might want to ...
arrays4/4/2007
  Q: have a class and a program to use the class for an array blueprint. In the main, declared an array, ...
  A: You should include some code. It would aid me in helping you. Try this, when calling the method, ...
package ff; importing..4/4/2007
  Q: My question and problem of packages, that i had created called ff, which was asked to u, at last i ...
  A: Glad you found a solution. By the way, to always include the current working directory in your ...
filtering4/3/2007
  Q: i need some help. now i'm develop a monitoring system with java. i want make a filtering to user ...
  A: Try something like this to query for a url that is in the database: boolean inDatabase = ...
Java Windows4/3/2007
  Q: If the user clicks a menu and the link opens a window to google - then he wants to check his mail ...
  A: This is really a JavaScript question and you should post in the JavaScript location. However, the ...
Java project3/30/2007
  Q: I am just writing to ask if you are familliar with arrays and methods. I have an assignment due, and ...
  A: Try the following: 1. To calculate the mean is simple, use the formula provided. 2. Same for std. ...
java errors..3/30/2007
  Q: i had created my own package called ff, and im unable to import the package in others program, i ...
  A: I would really advise you to sit down and read the Java documentation on use of "java.exe", ...
doubt in exception3/28/2007
  Q: exception always throw at run time..but java have some compile time exception..then how it can throw ...
  A: Compile time exceptions/errors normally occur when code is written badly or is simply wrong. e.g. ...
java errors..3/27/2007
  Q: i had created my own package called ff, and im unable to import the package in others program, i ...
  A: If the folder in which your project files (.java) are located is called src (shor for source), then ...
java errors..3/26/2007
  Q: i had created my own package called ff, and im unable to import the package in others program, i ...
  A: To just include the class, you could place the .java file in a folder called ff inside your src ...
background3/22/2007
  Q: I've created a 2D world in java but it has no background. I want to place a map on the background by ...
  A: Here is an example of a JPanel that can have an image as a background. You should be able to modify ...
(GUI) question about action listeners3/22/2007
  Q: i made this code below and my question is, How do i make action listeners for each checkbox so i ...
  A: To write action listeners for a checkbox, try the following: 1. Add an item listener to the ...
spell out numbers3/15/2007
  Q: Good day, sir. My professor asked us to write a program that lets us enter an integer and that will ...
  A: Try this: String num = Integer.toString(3245); char[] arr = num.toCharArray(); StringBuilder sb = ...
how to write and run the following output?3/11/2007
  Q: if i ignore the method range(double[] x), how should i traverse the passed in array and select the ...
  A: You could use the Math.max(a, b) method and Math.min(a, b) method. You get the first two values of ...
how to write and run the following output?3/10/2007
  Q: using method: static double range(double[] x) //returns difference between maximum&minimum //of the ...
  A: I have no reference for the method range(double[] x), so I am assuming that it should traverse the ...
extracting records from my database(ms access) and display in gui format java swing....3/7/2007
  Q: gud day expert.. i have a problem in my presently designed java swing program.i want to extract ...
  A: Here is some code that may help you: /** * Gets the DSN's from the user and system DSN lists. ...
how to answer this question by java program3/6/2007
  Q: USE'SWITCH' AND 'BREAK' STATEMENT TO ANSWER THIS QUESTION. Many visitor would like to know the ...
  A: Pseudo-code: int age = getAgeFromSomewhere(); int option = -1; if(age > 54) { option = 1; } ...
Java & Internet3/3/2007
  Q: I believe they send us the images in GIF, but I don't think it is downloaded onto my hard drive. ...
  A: Notepad has definately taken over opening the images. Try the following: Option 1: As before, ...
Java & Internet3/1/2007
  Q: I have Java installed on my PC. I have Windows XP professional. I am registered to receive images ...
  A: It sounds like the settings in your computer have been changed so that the downloaded files are ...
what is the wrong with following program2/28/2007
  Q: public class ShowErrors{ public static void main(String[] args){ for(inti=0;i<10;i++) ...
  A: According to the code you have posted, if you try to compile as is, the compilation will fail ...
creating an IDE2/26/2007
  Q: sir, any other links regarding tutorials/links for creating a java ide. in sourceforge, I found ...
  A: What you need to do is download the source code for some of the IDE's on sourceforge. Look through ...
creating an IDE2/24/2007
  Q: sir, I am planning to create a java IDE. I have read of ANT, XML,etc... . But one thing I was not ...
  A: Ant is mainly used in the build process to build Java apps, package and deploy them, etc. I would ...
EasyQ2/24/2007
  Q: I'm new to programming. I Have a very important question, please you help me, Java has a lot of ...
  A: J2SE which is the core of Java is the most used part of Java. It contains all the basics, GUI ...
Date Conversion2/23/2007
  Q: Hope u r doing good!! Can you tell me how to convert EEE MMM DD YYYY to yyyymmdd format in Java.. ...
  A: Assuming that you want to get a String representation of the Date, try this: /** * Converts a date ...
slideshow2/21/2007
  Q: I've been working on an image viewer/editor for the last couple weeks. Now I want to add a slide ...
  A: I am assuming that "selectedFiles" is a File array. Bear in mind that listFiles returns an array of ...
arrayList2/20/2007
  Q: I need the following code to firstly look at a value that is stored within a combo box, take this ...
  A: Problem 1: In the line String numIndex = (string) cboSelectFilms.getSelectedIndex(); you need to ...
I/O Stream2/18/2007
  Q: Both read() of InputStream and read() of character stream return char's int format, so what are the ...
  A: InputStream is used to read a stream of byte of data. The data is commonly read into a byte buffer ...
JAVA limitations?2/18/2007
  Q: I am running a programme written in JAVA or JavaScript that runs perfectly in the early stages of ...
  A: Java is not limited, but the Java version you are using most certainly is. One major problem is ...
TypeCasting2/11/2007
  Q: Please explore the Basic concepts of Typecasting and TypeCasting of objects.
  A: The rules for reference conversions (conversions that the compiler will not throw out) that can be ...
I/O Streams2/11/2007
  Q: As we know InputStream is an abstract class so what is the class of "System.in" object?
  A: The System class automatically creates a standard input, standard output, and standard error output ...
how to use putFields() and getFields()2/8/2007
  Q: I'm trying to store objects on the file to retrieve them back i want some field.I tried to do so by ...
  A: First of all, only objects that implement the java.io.Serializable interface can be serialized with ...
arraylists and vectors' methods2/5/2007
  Q: i have a simple question whenever i create an arraylist or vector and use its add() method (in the ...
  A: You get that message because you are not using Generics in your code. There is a basic tutorial on ...
MultiThreading2/3/2007
  Q: Why have wait() and notify() methods been defined in Object class not in Thread class?Why we do not ...
  A: These methods are defined in the Object class so that all classes which are created have these ...
hai1/22/2007
  Q: i want the source code of the cryptography using the RSA algorithm in java?
  A: Here is an example of RSA encryption. ------------------------------------- LAYNETWORKS.COM posted ...
java1/19/2007
  Q: how to fetch resume from excel spreadsheet and put it in ms-access please give code
  A: You can use the following the resources to read and write excel files. ...
Java J2SE GUI & JDBC1/19/2007
  Q: (1) Drag&DropTargetListener -----> To drag an object (label) and drop in the empty panel. ...
  A: You can modify the following code to do what you want. /** * Drop event. Used to open ...
Java coding1/18/2007
  Q: i need a Java code for a non functional calculator interface
  A: Here is the main class from a calculator app that I built some time ago. I have removed the ...
components in swing1/7/2007
  Q: i have a simple question how do you remove a component (such as a button or even a panel) from ...
  A: To remove a component from a JFrame or JPanel, use the remove(Component comp) or remove(int) methods ...
core java+static methods1/1/2007
  Q: could i have the reason of it that we cannot directly call the non static methods in static methods. ...
  A: Non-static methods are associated with an instance of the class. They typically operate on state ...
Java Fundamentals12/24/2006
  Q: I've got an exam coming up and i need help on the following categories. Please explain in detail and ...
  A: To answer answer all of your questions in detail would take a lot of time. Here are some quick ...
Help!!12/21/2006
  Q: 1.What is a constructor and why is it important? Is it possible to write a java code without a ...
  A: 1. A constructor is where you would call important code that needs to be set up before using the ...
Generics and Type Erasure problem.12/17/2006
  Q: I've tried searching the web for 2 days without answer. I have a ApplicationHelper.java that ...
  A: I have faced the same problem in JDK 5 with generics. Unfortunately, I had to play around a little ...
Here is the code12/10/2006
  Q: package airlineticketcost2; /** * <p>Title: airlineTicketCost2</p> * * <p>Description: </p> * ...
  A: Can't compile the code. Need the 'Business' and 'First' classes. Could you post it? I have gone ...
SCJP12/8/2006
  Q: QUESTION NO 111 Given: 1. public class Foo { 2. private int val; 3. public foo(int v) (val = v;) } ...
  A: Q111 A because a is a new Foo object and c points at that object. i.e. both a and c point to the ...
SCJP12/8/2006
  Q: QUESTION NO: 97 Exhibit: 1. public class X { 2. public static void main (String[]args) { 3. int [] a ...
  A: Q97 B because int[] arrays are automatically initialized on creation with a value of 0 which is ...
SCJP12/8/2006
  Q: QUESTION NO: 92 Given: 1. String foo = “blue”; 2. Boolean[]bar = new Boolean [1]; 3. if (bar[0]) { ...
  A: Q92 bar[0] is an object. You need to get the boolean value for it be correct ...
SCJP12/8/2006
  Q: QUESTION NO: 79 Exhibit: 1. class super { 2. public int getLength() {return 4;} 3. } 4. 5. public ...
  A: Q79 E because overriding method should return int at line 6 Q87 C because you want to get the ...
Java12/8/2006
  Q: Problem with if statement. Why does the reservation fee still showing $20.00 when I don not want a ...
  A: I think you mean in the public static double reservationFee() method? The code looks ok and should ...
SCJP12/5/2006
  Q: Question No: 6 Exhibit: 20. Public class test ( 21. Public static void stringReplace (String text) ( ...
  A: Neither stringReplace nor bufferReplace return anything. So, whatever is passed in to these methods, ...
SCJP12/4/2006
  Q: QUESTION NO: 113 Given: 1. public class SyncTest { 2. private int x; 3. private int y; 4. private ...
  A: This is because the methods are not fully synchronized. At some point class P can call setXY and the ...
SCJP12/1/2006
  Q: QUESTION 66 Given: 1. class A { 2. } 3. class Alpha { 4. private A myA = new A(); 5. 6. void dolt( A ...
  A: B because none of the other methods are called and thus if myA is set to null, it is not ...
Why is this applet not working for some people but working for others?12/1/2006
  Q: This applet works for me, and many others, but some people have complained that it doesn't work for ...
  A: I looked at the applet myself and had no problems. I did notice that it is fairly large and on ...
SCJP11/30/2006
  Q: QUESTION 27 Given: 1. public class SwitchTest { 2. public static void main(String[] args) { 3. ...
  A: See my comments in the code for the explanation: 1. public class SwitchTest { 2. public static void ...
SCJP11/30/2006
  Q: QUESTION 16 Given: 1. public class Delta { 2. static boolean foo(char c) { 3. System.out.print(c); ...
  A: The answer lies in how a for loop is executed. 1. Enter the loop, look at initial value, print A 2. ...
SCJPJAVA11/30/2006
  Q: QUESTION 4 Given: 1. class Test { 2. private Demo d; 3. void start() { 4. d = new Demo(); 5. ...
  A: E because the demo object still exists at line 10. It is set to null at line 9, but then immediately ...
SCJPJAVA11/29/2006
  Q: QUESTION 25 Given: 1. class TestSuper { 2. TestSuper(int i) { } 3. } 4. class TestSub extends ...
  A: Compilation fails because when line 7 is called, it calls the default constructor of the TestSub ...
Don't know why I'm getting a null pointer exception11/28/2006
  Q: I'm teaching myself Java and I'm trying to use an array of objects I created but I'm getting a null ...
  A: When I instantiate an array of objects doesn't that instantiate each object of the array? -> No it ...
Jtext area11/27/2006
  Q: how do i write a program which will generate random numbers from 1-5,the user will have to guess ...
  A: Use Math.random() to generate the random numbers. The number the user enters is stored in a ...
Mozilla browser is Stateless ?11/23/2006
  Q: Is Mozilla browser is stateless ? Means When we close the MS Internet Explorer it doesnot remeber ...
  A: I think what you are trying to do may work better with cookies. Some browser simple will not allow a ...
Query on JSP with Javabeans11/22/2006
  Q: I am Sunil, I have one query.How to get multiple values from jsp using javabeans class. For ...
  A: Is not possible to simple declare an array in you code? e.g. public class StudentBean implements ...
Request by code11/22/2006
  Q: I'm working on an application development whose main function is act like a filter to the request ...
  A: I think your question is a little out of my league. I will give it a try though. From what I can ...
how to access data site that use ActiveX controls11/22/2006
  Q: I want to pull data from a web site that is heavily using Ms-ActiveX controls. How can i do this ...
  A: I'm not really sure how (or why) you would want to do this. You might try writing a program that can ...
Java (RS) hacking11/19/2006
  Q: So i have read one question about hacking into runescae adn read the answer that states that the ...
  A: I don't normally answer questions about Runescape. To answer your questions though, 1. People are ...
java,servlets11/16/2006
  Q: what is garbagecollector?how can we use this?where can we use?is it gc already builtin or not?what ...
  A: The java garbage collecter runs automatically once in a while to free up memory that is no longer ...
java class11/13/2006
  Q: I have written a class in Java. I would like to run this class in a browser. Can you tell me what ...
  A: In order for your class to run in a browser, you must write it as a Java applet. This is done by ...
Stackoverflow error11/11/2006
  Q: I have a connectivity problem where I have to select a number of vertices(N) and connect them with ...
  A: StackOverflowErrors are commonly caused by your program running out of memory. See some of my ...
Not sure11/10/2006
  Q: I think I have a Java related problem but I'm not sure. It's simple - I can't seem to attach files ...
  A: I can't really answer your question without more information. For example, 1. What email client are ...
stack overflow error11/9/2006
  Q: could you tell me why does this sudoku-solver ends up with stack over flow what ever matrix user ...
  A: Stack overflow errors are usually cause by method that are recursive. These method call themselves ...
placing image icon on a 3D cube11/3/2006
  Q: sorry to trouble you again, while waiting for your reply, i have face another problem where i dont ...
  A: Sorry for the delay in getting back to you. Unfortunately, I still cant build your code. package ...
jsf internationalization in arabic11/1/2006
  Q: hai, i new to jsf.but the project must support arabic language in j2ee platform.i stored the arabic ...
  A: I have tried doing some research on your problem. Most people say that you should use native2ascii ...
java Networking10/31/2006
  Q: Please i need help..i want to create Desktop chatting Application with java that [Work on ...
  A: You need to build aclient side program and a server side program. No special API is necessary. Here ...
jsf internationalization in arabic10/31/2006
  Q: hai, i new to jsf.but the project must support arabic language in j2ee platform.i stored the arabic ...
  A: First of all, make sure that you have the required fonts installed on your computer to display ...
array binarytree10/25/2006
  Q: I'm trying to convert linked representation of a binary tree to its array format, but I'm having ...
  A: What if you first add the array elements to a Vector for example, and then copy these to an array? ...
object oriented programming10/24/2006
  Q: i am asked to write a method using Java to compare two objects or inputs from the user using ...
  A: Here is an example: int compareTo(String s) - returns a negative value if the String is "less ...
java 3D10/23/2006
  Q: Thx for the links. Sorry but to ask you one problem that i haven encounter. I try importing the 3D ...
  A: Make sure the JAR file containing the classes is in your build path. You can use the -cp or ...
While loop prime numbers problem10/23/2006
  Q: How to determine if its a prime number or not in a while loop problem
  A: //Try this public class PrimeNumberTest { public static void main(String[] args) { int ...
java 3D10/19/2006
  Q: i am sorry to trouble you again, my supervisor assign me a new task. My task is to zoom in a certain ...
  A: I don't have time at the moment to write out any code as I am very busy at work. Here are a few ...
java says it needs to be enabled10/18/2006
  Q: i hope you can help me.. ive used Java for a long time and never had any problems with it until now. ...
  A: First check if Java is installed properly. Do the following: 1. Open command prompt or a terminal. ...
java 3D10/16/2006
  Q: i am doing a project on java 2D and 3D. I have finished the 2D portion and proceeding to do the 3D ...
  A: Here is a sequence of steps you could follow to zoom: 1. Take your image and make a BufferedImage ...
About java reference10/13/2006
  Q: im starting to progam in java especially in mobile using netbeans 5.0,can you give the list or ...
  A: The netbeans mobility download page has a number of links to tutorials and articles.Check ...
Java10/11/2006
  Q: how to get console window(as we get in .net when run the console application)as we run a java ...
  A: When running a Java program, the command prompt is normally displayed. This is always the case. ...
Executing a java program from another directory10/2/2006
  Q: Sir, My problem is: I have one java program in the current directory "C:\Current" by name ...
  A: For your first problem, you might try passing the run command as a complete string to the exec ...
asking for tutorials10/2/2006
  Q: im a programmer but of different language,im reading right now about mobile application in Java ...
  A: As far as tutorials about mobile application programming with Java are concerned, a Google search ...
Change the design interface of the JButton10/2/2006
  Q: i have a question regarding JButton. Is that any way that i can use coding to change the interface ...
  A: You can change the way a JButton looks by extending the JButton class. You can make the button ...
create a jar file using JCreator10/1/2006
  Q: I am using JCreator to write my program and I want to create a jar file so I can run it on any ...
  A: I don't personally use JCreator so I'm not so familiar with it. I did download it have a quick look ...
simple java application program10/1/2006
  Q: Gud day Mr. Brian Ngure!!! we are assigned and given (in a class) a simple java program to ...
  A: I don't give full answers for this type of question (because that would be doing your homework for ...
graphics9/26/2006
  Q: i would like to create two circles that appear randomly on a window and every time they overlap a ...
  A: Use the drawOval(int x, int y, int width, int height) method in the Graphics class to draw your ...
difference between .eqauls() method and == operator9/21/2006
  Q: equals() method and == operator in java, im quite confused regarding these two when use what, can u ...
  A: This is something which confuses a lot of Java programmers. equals() is a special method that ...
Executing a java program through another using Runtime.getRuntime.exec()9/18/2006
  Q: Sir, can u tell me how to ececute a java program which is already compiled using another java ...
  A: You need to do something like this: public class Using { public static void main(String ...
problem with opera9/7/2006
  Q: really its good of having this site. coming to question i developed program its working fine in ...
  A: It is well documented that Opera does not fire load and unload events. I have not been able to find ...
How to get data from another Frame9/4/2006
  Q: I have 2 Frames in second I select an item from JList. How in first frame to display witch item was ...
  A: In your second frame, you need to add a ListSelectionListener to your JList like this: ...
Returning from a while loop8/30/2006
  Q: I have another question I'm hoping you can clear up for me. I have written a method that has a ...
  A: Glad to help. To answer your question, no you do not need to do anything else. Here is why: When ...
application memory space8/30/2006
  Q: I have three questions about application memory management, 1.does an application run within its ...
  A: Memory management in Java is handled by the JVM. To answer your questions: 1. Does an application ...
Java switch statements8/29/2006
  Q: I'm hoping you can help me. I could have sworn it was possible to write Java switch statements ...
  A: What you want is called "falling through". This happens when you do not include the break statement. ...
signed applet certificate8/28/2006
  Q: i signed my applet and i got six months free certificate,but now my problem is can i get certificate ...
  A: In order to extend the time the signature is valid, you need to specify the time in the keytool ...
signed applet certificate8/28/2006
  Q: i signed my applet and i got six months free certificate,but now my problem is can i get certificate ...
  A: Did you sign the applet using a certified authority (e.g. Thawte) or did you generate the signature ...
MouseInputListener8/24/2006
  Q: I have problem I've searched on a whole day. I have a class called ToiletLabel and it is an ...
  A: Sorry for the delay in answering. I have had a quick look at your code and while it seems to ok and ...
getting images dinamically8/24/2006
  Q: iam new to core java can u plz tell me how to get images dinamically, means i want all the images ...
  A: If you would really like me to write out some code for you, I suppose I could. This will take a bit ...
getting images from remote machine using applets8/23/2006
  Q: iam woring in larsen and toubro mysore,india. iam new to core java. in my project i compleated ...
  A: 1. Can we communicate with other pc using applets? Not really. Java applets must run in a "sandbox" ...
retriving images from server dinamically8/22/2006
  Q: my name is krishna kanth working in larsen and toubro ltd ,Mysore. i am new to java my question is ...
  A: One method you may try is to use a reuseable image servlet. Here is a basic example. JSF ...
INT expression8/8/2006
  Q: Why the expression involving int or smaller data type is always an int in Java ? Example : byte a ...
  A: This happens because Java has certain automatic casts and checks it performs. In your example, the ...
Static method override8/8/2006
  Q: Why static method can't be overridden in Java ?
  A: Static means one per class, not one for each object no matter how many instance of a class might ...
Import statement in Java8/8/2006
  Q: why import statement is introduced in Java ? Since the CLASSPATH shows the directory for all ...
  A: Sorry for delay, problems with connection. Import statements are needed because of the package ...
Outputting Text into a JPanel in Java7/26/2006
  Q: I am designing and coding a sharable calendar with a client-server relationship. I am trying to ...
  A: First of all, it is not possible to actually add text directly to a JPanel. You need to add the text ...
java7/21/2006
  Q: I am having a String object s= "7/21/06"; i want ot change the string object to date object. ...
  A: You need to format your Date using the java.text.DateFormat class. e.g. DateFormat df = ...
java packages7/17/2006
  Q: Is the system varialbe name JAVA_HOME, PATH, or CLASSPATH?How do I set my classpath to include ...
  A: There should be at least two of these defined in your system variables under "My Computer". All ...
java packages7/17/2006
  Q: How do I set my classpath to include packages? For example if I want to create a gui with Netbeans ...
  A: There are a number of ways to include packages in your classpath. If you are using Netbeans, do the ...
Java Program distribution7/14/2006
  Q: How do I distribute my finished product (Java program)? If I use the JFreeChart and Jexcelapi to ...
  A: To distribute a java program, you can create a java installer for it using one of the many free ...
Java Excel7/14/2006
  Q: What do I use or how do I write and parse Excel with Java? Also, how do I install java packages, ...
  A: There are a number of open source libraries that you can use to write and parse Excel documents ...
running time problem7/13/2006
  Q: I did what you instructed to do. but, when I do >java -version java version "1.4.2_03" Java(TM) 2 ...
  A: Ok. First, it would be wise to uninstall the JDK version 1.4. It is redundant and just clogs up your ...
running time problem7/13/2006
  Q: How can I install JRE 1.4 and set the JAVA_HOME path?I just started on java and wrote the ...
  A: To install, download the latest JDK version from http://java.sun.com (I think it is version ...
running time problem7/13/2006
  Q: I just started on java and wrote the helloworld.java program. It compiled fine. Now, when I run the ...
  A: java.lang.UnsupportedClassVersionError: Ch2Birthdate (Unsupported major.minor version 49.0) This is ...
JAVA7/8/2006
  Q: I created a form with a button in java. How can I open an application e.g. (Microsoft calculator) ...
  A: This is a quick answer to your question. Play around with it and you could add more functionality. ...
i cant uninstall Java6/26/2006
  Q: my name is Aaron. I am having trouble uninstalling Java. When i got to Control Panel and clicked Add ...
  A: You could try download the full Java installation and install it (do not install from the net), then ...
How to Print a Simple Text File in Java?6/24/2006
  Q: I have a question. I am developing an application where i want to print a simple text file in Java. ...
  A: There are many ways to print a text file in Java. If you have the JDK 6.0, this functionality has ...
Java Superposition of Waves6/10/2006
  Q: I have chosen to take on a project for my physics teacher that involves calculating the ...
  A: I have had a quick look at your code. The best advice I can give here is to look at some of the ...

All Questions in This Category

Java

All Answers


Answers by Expert:


Ask Experts

Volunteer


Brian Ngure

Top Expert on this page

Expertise

Strong in Java. Will be able to answer both in areas of designing and coding. Some knowledge in servlets

Experience

5 years of Java experience, Sun Certified Java Associate and Sun Certified Java Programmer, JDK 1.4

©2012 About.com, a part of The New York Times Company. All rights reserved.