32,199 Topics
| |
I need to create two public static void mains, however when trying to create "mainfunction", I run into the illegal start of expression. Please help. import java.io.*; import java.util.Scanner; public class guessinggame { public static void main (String []args) { Scanner scanner = new Scanner(System.in); System.out.println ("Guessing Game"); System.out.println ("Do … | |
Hey guys i am having a problem with displaying a single record out of a text file the code is not reaching the "if" function in the while loop of the "getRecord" Function please help. Everything else is working import java.io.*; import java.util.Scanner; import java.util.InputMismatchException; public class FileTest { //Globals … | |
| Hey guys, As the title says, I want to know how I can reverse the characters in a string, but retaining the placement of the words as such, here's the code I used: [CODE]class reverse { void reverse(String s) { int l=s.length(),j=0; String s1=""; for(;j<l;j++) { char a=s.charAt(j); if(a==' ') … |
I am trying to create a player class to pick up and drop as well as carry items and this is the code I have so far. However, I am unsure what needs to be changed for it to work. import java.util.ArrayList; public class Player { private String Name_; private … | |
We have a socket application with lots of queries in it. The problem after doing some sample of jmap -histo we notice the number of sockets keep growing and resultsets fluctuates. Checked through and ensure all the resultset are closed and finally even the socket is close just based on … | |
i having thread class ,each time when i am calling it creates new object and run new thread, i want to access specified thread variable from another class. is it possible??? help me.... | |
I have class with two method to read and write to file and in my GUI jFram ArrayList<PersonTest> person = new ArrayList<>(); RWData readWrite = new RWData(); DefaultListModel<PersonTest> model; private void fillList() { model = new DefaultListModel<>(); for (PersonTest temp : person) { model.addElement(temp); } jList1.setModel(model); } private void btnLoadActionPerformed(java.awt.event.ActionEvent … | |
Multiple generic arrays is it possible to create something like <String, Integer>[] a; If I wanted to create an array that stores objects of String and Integer? | |
I am a newbie to hibernate and I am trying to insert a row. The below is my code along with log. I am not getting any exception, however when verified in the Database, the row itself is not getting inserted. hibernate-cfg.xml <?xml version='1.0' encoding='utf-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration … | |
im trying to do this for fun but i cant figure out why i keep getting "null" instead of previous entry. ps. this isnt homework Thank you public class GetUser { public static void main(String[] args) { String name; String a []; char x='y'; int i; int n=1; do{ System.out.println(); … | |
I am trying to add /edit records in an embedded database. I have written some code that I think might work, but I would like a second set of eyes to look at to see if it is coded correctly..... private void Save_Item___MouseClicked(java.awt.event.MouseEvent evt) { if ("Equipment - Mundane".equals(jComboBox1.getSelectedItem().toString())) { … | |
I'm trying to finish up this vending machine. It worked well until I tried to add multiple items via inheritance while using a toString method. I'm not sure what is wrong about how I've done this. import java.util.Scanner; public class VendingMachine { public static double moneyCredit; public static double itemCost; … | |
Is there any option which i can activate when using ECLIPSE so that when i m typing S... for String or i.. for int etc... to automaticly give me suggestions that i want a int if the first letter is i or i want a String if the first letter … | |
I need to create a method compact that can remove all zeroes from an array and leave the order of other elements unchanged, but without creating a new array. The method must actually remove all zeroes, not just print out the other elements, and it should only use one private … | |
Hi Team, I have learned RMI Applcation basics.I have a Doubt in setting the Codebase and security policy file in the program during compile time itself rather than manually giving it during run time . During run time we will give like below in the command prompt, C:\>java -cp .;c:\hello.jar … | |
When throws keyword is used? Who knows best answer for that question? | |
My computer does not have the swing.properties. How to make a swing.properties file and with what software? | |
Hi, I am new to java, so please be nice. I am trying to make an application in Netbeans, i know the basics of how to use the program but get a little stuck when it comes to programming. At the moment i am trying to get a button to … | |
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; import java.util.Scanner; import javax.swing.filechooser.*; import javax.swing.ScrollPaneConstants; public class validatiorGUI implements ActionListener { JFrame frame = new JFrame("C0015665"); JFileChooser chooser = new JFileChooser(); JPanel aPanel = new JPanel(); // create text area and buttons JTextArea area = new JTextArea(); JButton openButton = new … | |
Hi, I studied Java last year in university but I found it rather difficult - mainly because I made it difficult for myself by not studying as much - but hey. I've been working on a console-based "game" with the language and I've just had a hit of inspiration to … | |
Is there any way that I don't use lots of IF statements?,right now it is according to Index of combo box items. else if(e.getSource().equals(jcb1)) { int selectedindex = jcb1.getSelectedIndex(); String comb_string = (String)jcb1.getSelectedItem(); if(selectedindex==1) { try { //String sql_command ="select * , count(*) over (partition by 1) total_rows from Employer … | |
This is what I have to do: Write an application that asks the user to input the radius of a circle as a floating-point number and draws the circle, as well as the values of the circle's diameter, circumference and area. Use the value 3.14159 for pi. [Note: You may … | |
this is the result i am trying to: http://beepleased.com/wordpress/wp-content/uploads/2013/11/2.jpg and this is my code: panelSignUp.add(new JLabel("Name:")); // this.getContentPane().add(nameTextField,) panelSignUp.add(nameTextField); panelSignUp.add(new JLabel("Email:")); // this.getContentPane().add(nameTextField,) panelSignUp.add(emailTextField); panelSignUp.add(new JLabel("Username:")); // this.getContentPane().add(nameTextField,) panelSignUp.add(userNameTextField); panelSignUp.add(new JLabel("Password:")); // this.getContentPane().add(nameTextField,) panelSignUp.add(passwordTextField); panelSignUp.add(signDone); this.setLayout(new GridLayout(5,2)); this.setContentPane(panelSignUp); this.setSize(400, 300); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.setVisible(true); all go well, the only problem is that … | |
Hi friends I am using eclipse and oracle 11g r2 i tried to configure oracle with eclipse "a driver already exists with that name please provide a unique driver name" This is the error I am getting kindly help me to fix this error thanks for your time. | |
Alright so I am making a rock paper scissors games and along with this game I am making a graph to show who has won more. My problem is how do I keep drawing the graph everytime someone wins? | |
hi friends am nubie here and in world of programming i ve a i've learn few things about java programming and i wish to create a pos system using java but don't know were to start from, i need a head up my part of programming some advice and a … | |
hello guys i am still new in java and i have been battling with this problem. i want to filter my data in my jtable. i have got the following data in my jtable which is from my database. | name | gender | courses | |------|--------|---------| | Ben | … | |
Hi everyone! In my code when I click on the "Show Results" button it shows me the result is a table in another interface other than the main interface, untel now everything is fine but when I changed the method : I just want to show this table in the … | |
I need to print out a pattern that looks like this when N=6 1 21 321 4321 54321 654321 |
The End.