32,204 Topics
| |
I want to read an input from a text file: Test1.jpg Test2.jpg Test3.jpg each name is separated by an empty line, i want to get all the names and store them into a arraylist. I am using while((line=inputFile.readLine())!=null) will this work because when it hits the empty line, it will … | |
Hi very one could someone help me with "delete method for Array" I wrote this method in class Array but I didn’t know how could I decrement the size of array and I couldn’t make it work this is the method [code]public void delete(int c) { for (int i=0;i<a.length;i++){ if(a[i]==c) … | |
I keep getting this error. The app is looking for a class and in fact so am I where should this class be? I can't find it in the: [b]db-derby-10.6.2.1-bin[/b] and check sup of the dl said it was unaltered? Thanks [code] java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) … | |
How do I write an event listener that displays an image when I click the upload button? so far i have [CODE] jButton1 = new javax.swing.JButton(); jButton1.setText("Upload"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } });[/CODE] and then [CODE]//the LOAD button for loading the file private void jButton1ActionPerformed(java.awt.event.ActionEvent … | |
[CODE] String[] names = new String[namesListSet.size()]; int[] nums = new int[namestimesSet.size()]; namesListSet.toArray(names); [B]namestimesSet.toArray(nums);[/B] for (String s : names) { System.out.print(s); } [/CODE] i'm getting an error on the bold part. getting symbol not found. | |
[CODE]String[] myArray = {"Player 30","Player2 35"};[/CODE] This statement [CODE]Arrays.sort(scoreArray);[/CODE] will sort myArray by Letters. Output: [CODE]aPlayer 30 bPlayer 35[/CODE] Problem: Is there a way to sort myArray by numbers from highest to lowest? The output should be: [CODE]bPlayer 35 aPlayer 30[/CODE] I even tried foolish things like. [CODE]String[] myArray = … | |
The [COLOR="Red"]red[/COLOR] is where the problem is: Thanks for the help. [code] // The "ChoseYourStory" class. import java.awt.*; import hsa.Console; public class ChoseYourStory { static Console c; // The output console public static void main (String[] args) { c = new Console (); int move; String start = ("yes"); int … | |
can somebody tell me what this code actually does? [CODE] int i = 0; while (i < -1) { double x = xCoordinates[i]; double y = yCoordinates[i]; long xx = getWidth() - Math.round((double) getWidth() * x / 1024.0); long yy = getHeight()- Math.round((double) getHeight() * y / 768.0); g2.translate(xx, yy); … | |
Can someone teach me or guide me using GUI..or can some one help how to understand right away the GUI..and please give the link which can help me to learn more about GUI.. | |
//This is the error that i have Exception in thread "main" java.lang.NullPointerException //at CardTest.main(CardTest.java:16) /** * @(#)CardTest.java * * * @Robert Coughlin * @version 1.00 2010/10/15 */ //this is the main public class CardTest { public static void main(String [] args) { Card [] randomCard=new Card[20]; for(int i= 0; i<20; … | |
I have this txt file containing names and scores. "[COLOR="red"]ex. Player1 35[/COLOR]". My program able to read it and store it to an Array of String. Here's my question. Is possible to separate the name and the score and store them in different Arrays? [CODE]ex. myArray = {"Player1 35","Player2 30"};[/CODE] … | |
Hi I have a project in which I have to build an algorithm visualization tool. Up until now I have been going in a static direction thinking of having in built menus that allowed a user to create an animation of a sorting algorithms but now my tutor wants me … | |
Why is my while statement being ignored? [B]Problem:[/B] Write a method called squareRoot that takes a double as a parameter and that returns an approximation of the square root of the parameter, using this algorithm. You may not use the built-in method Math.sqrt. As your initial guess, you should use … | |
Hi, anyone can help me on how to connect PHPMyAdmin with java? | |
Hii all, Using Scanner class I am accepting an input string which serves as a password field Is it possible to mask the field while the input is being given ?? eg: This is how my output will be : Username : abcde1 Password : abcd@xyz This inputs are given … | |
Write a java program that calculates the grade point average of three course and their credit hours through, if the grade points and credit hours are as follows: COURSE/SUBJECT GRADE GRADEPOINT CREDIT HOURS Maths A 4.0 3 English composition B 3.0 2 French B+ 3.3 3 Now, if the grade … | |
Im writing a program that will instatiate an object from another object but I have no idea how to get it to work. Here is my main code [code] public class testPurse { public static void main(String[] args) { Purse p1 = new Purse(); System.out.println(p1); p1.insert(3,0,2,1); System.out.println(p1); p1.insert(3,1,1,3); System.out.println(p1); p1.remove(3,1,0,2); … | |
Can somebody pls explain me this error that I am getting when I try to run my web application on Tomcat. java.lang.NullPointerException business.Cart.addItem(Cart.java:27) cart.CartServlet.doGet(CartServlet.java:49) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) The code for the Cart.java is [CODE]package business; import java.io.Serializable; import java.util.ArrayList; public class Cart implements Serializable { private ArrayList<LineItem> items; public Cart() { … | |
here is code for my assignment. I am getting: Exception in thread "main" java.lang.NullPointerException at SortedStringList.insert(SortedStringList.java:33) at TestSortedStringList.main(TestSortedStringList.java:6) Line 33 is the "while" loop in my insert. Its supposed to be a double linked list of nodes w/string in each node, alphabetically arranged. here is the code: public class SortedStringList … | |
[CODE] String names1 = ""; System.out.println("enter names: "); names1 = kb.next(); while (names1 != "stop") { System.out.println("enter names: "); names1 = kb.next(); namesList.add(names1); } [/CODE] everytime i type "stop," the program keeps running... | |
Hi all, Im having issues with this program. I've looked online and seen others that have basically the same program but have issues also. My issue is a compiling error, thats one problem thats obvious to me. This program is suppose to get the user to enter grades for five … | |
Hello Members, Does BlueJ support Networking? Can you have the main() of Client.java and Server.java running at same time? I always get this "Your program is running.You cannot start another execution......". Any help would be greatly appreciated. Thank you!! sciprog1 | |
[code] c = new Console (); int lvl = 1; double exp = 0; int x = 1; double monsterhp; int monslvl = 1; int a = 1; while (a == 1) { int lvlup = 10 + (lvl * 40); if (exp >= lvlup) { lvl = lvl + … | |
i want to disable the NO and CANCEL option , can you guys help me because im only a begineer of JOPTION here is ma code: btw this is my assignment in my 1st year college "compro" my teacher tell us to create a program , and my system is … | |
Hello, I am in Object Oriented Design for C++ at the moment... The test we are having has a question on it and the professor wants us to find and know the answer before we come in for the test. The question is this: The following code out puts what … | |
Hey!I have to make a Quiz game using arrays in java...Now,i have to create a random function such that the questions appear randomly n without any repetition?plz help... Here's the code: [code]import java.util.*; public class KBC { String questions[]; String options[][]; int answers[]; long money[]; int history[]; public KBC() { … | |
I'm doing an assignment for a Data Structures class, and I'm supposed to to implement a binary search tree with a client side method to create the tree. I've gotten most of it running I think, based on some debugging lines I added to track which part of the code … | |
Hi! I'm making a code right now but I don't know how to continue.....my problem is that I have to make an online shopping list...first, data will be shown to the viewer or buyer...i've done that already. next the buyer should enter the itemID then the number of pieces of … | |
I have created a Java program which scans a given folder and creates a .txt with a list of names of all the files in that folder. I want to create a table on MYSQL server on a website and fill it with the names of the files given in … | |
I need to sort a text file that has text, whole integers and float integers. The code I have thus far is able to take the data and perform required calculations. Next I need help with sorting by last name and outputting data in a table. I was successful in … |
The End.