35,618 Topics
![]() | |
Hello, I just needed some help with a code error. When I compile the code below, I keep getting this error: Program2.java:12: error: ';' expected Scanner keyboard = new Scanner(System.in); 1 error Could somebody please let me know what I am doing wrong? Thanks. import java.util.Scanner; // Needed for Scanner … | |
Can anyone correct my mistake. Provided code: public void testSetBaseSalaryNegative() { final double altBaseSalary = -999.99; try { emp.setBaseSalary(altBaseSalary); // Expecting an IllegalArgumentException fail ("Negative base-salary values should be rejected by setBaseSalary and result in an IllegalArgumentException"); } catch (IllegalArgumentException ex) { // This is the nominal case } catch … | |
Hi All I am using struts2 for my multi lingual web application.Here I am faceing a problem with select box ,which contains options in different languages. I am using standard HTML code for representaion of the characters in different languages. Problem is selectbox not showing options in diff languages,rather it … | |
hi how to fix org.hibernate.HibernateException i am using eclipse and oracle 10g thanking you | |
How can i implement this constructor? I tried replacing commissionEmployee = new CommissionEmployee with this but the complier asked me to create another constructor. public class BasePlusCommissionEmployeeComposition { private double baseSalary; private CommissionEmployee commissionEmployee; // six-argument constructor public BasePlusCommissionEmployeeComposition( String first, String last, String ssn, double sales, double rate, double … | |
there are two panel in one panel there is search button and in the another one there is Jtable for displaying search result. In that jtable initially all the records are displayed. But when i try to search, it works but the problem is that i need to click search … | |
Hi, What is for ( : ) in java.i know what a loop is but lately when i am doing excercises these keep coming up Example:** for(Field currentField : emp.getClass().getDeclaredFields())** | |
![]() | I created a JTree and also created a class which implements `TreeSelectionListener` then I pass that object into the JTree's function `addTreeSelectionListener`. In the [JavaDocs](http://docs.oracle.com/javase/tutorial/uiswing/examples/components/TreeDemoProject/src/components/TreeDemo.java), there is an example where they implemented the function `public void valueChanged(TreeSelectionEvent e)` within the main class and passed `this` into `addTreeSelectionListener`. I tried to … |
Hello everybody! My roommate had a problem and asked me for some help. I do not write in Java so I would need some help translating my code from PHP into Java. Here is the code: <?php mysql_connect ( "someserver", "someusername", "somepassword" ) ; mysql_select_db("somedatabase"); $q = mysql_query ( "SELECT … | |
What is the difference between import static java.lang.System; and import static java.lang.System.*; | |
I'm beginning android development and was going through some guides in which I tumbled across this piece of code : myEditText.setOnKeyListener (new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) { todoItems.add(0, myEditText.getText().toString()); aa.notifyDataSetChanged(); myEditText.setText(“”); return true; } return … | |
public void findHighestNumber(int timesToLoop) { int highNumber = 0; int counter = 0; int userInput = 0; while(counter < timesToLoop) { System.out.print("Enter a whole number: "); userInput = reader.getInput(); counter++; System.out.println(""); } if(userInput > highNumber) { highNumber = userInput; } if(counter == timesToLoop) { System.out.println("Finished looping! Highest is " +highNumber); … | |
What is the difference between java and java script ? No Google Use :) | |
**Pyramid Pattern** Dear Listers, I am in the process of wrting a java code that prints the following pattern 123454321 1234*4321 123***321 12*****21 1*******1 This is the code that I have written as public class Pyramid { public static void main(String[] args) { int j; for (int i=1; i<5; i++) … | |
hi all, i am building a squared pyramid calculator and writing all the code from scratch, but I seem to have run into my first problem though. i am giving the user a welcome message and then giving them a dropdown menu asking them what they want to "adjust" for … | |
Can Anyone please take a loo at this code and tell me whats wrong??? Sorry.................for the indentation is screwed :( import java.applet.*; import java.awt.*; import java.net.*; import java.awt.event.*; import java.util.*; public class Pritish extends Applet implements ActionListener implements Runnable { Thread t,t1; public void init() { String link1 = "yahoo"; … | |
hi! I have 2 columns SWT table. but when I insert data (from Mysql query), it appear only in the first column. for make it show in the second, I have to change the size of the column and then the data appear. so right now, after every query, I … | |
I want to do something like a high scores list in my game application. I was wondering, if I can load a picture file into my game, why can't I add a text file? How would I go about having my program add text to a text file, and is … | |
Hello, I'm pretty new to Java and this is my first GUI project, so try to explain like I am 5. I declare a label normally, then I set an Icon into it like this: x=rand.nextInt(4)+1; if (x==1) { computer.changeInfo("Fox McCloud", 500, 250, 100, 100, 65, 25, 15, 110, 35, … | |
Hello, i am now trying to draw a tree with stars using for loop. I find a code for this but i did not get the logic of the code. Please can anybody explain it to me ? The code is below: public class DrawingTree { public static void main(String[]args) … | |
i Have a problem with popup list When i type a charactor in jtextfield popup list is show popup but when i press the down arrow its cant select index of popup lists | |
I am making a simple GUI program in java. In this program I have made a simple jFrame where there is two separate textField, one for user input number(data type: double) and another for square of the input number as answer. What I want is: * The event action to … | |
hi does nay one know how can i implement the Totally Ordered Multitasking in java | |
I am running an application in which i am running an audio when it is clicked on image, while audio is being played and i changed the mode from landscape to portrait or from portrait to landscape and click on image, it plays another audio clip i.e. 2 audios are … | |
Hello, thought I'd ask before getting too deep into code to make sure I understand this properly. As described in the Gamma et. al. book the Visitor Pattern looks something like this: interface Visitor{ public void visitX(X x); public void visitY(Y y); public void visitZ(Z z); } interface Visited { … | |
hi i tried running the code below as the server: public static void main(String args[]) { DatagramSocket socket = new DatagramSocket(); //construct a datagram socket and binds it to the available port and the localhos byte[] b = new byte[32]; //creates a variable b of type byte DatagramPacket dgram; dgram … | |
i want to show monthly record on one pagein a jtable, when i press next page button the record in jtable shows the secound months record | |
I have a bookstore application, but I cannot show the maximum and minimum and maximum price of the book, in the end the program. Please see my codes below. import java.util.*; public class Book{ public static void main(String args[]){ int numOfBook; double totalCost = 0; String expBookTitle = ""; double … | |
I want to update the contents of Jtable as shown below when the Jcombobox's item state is chaged in the left panel. but i am not being successful in it .Please help.  when the table no value is changed in the left panel , i want corresponding Jtable … |
The End.