32,199 Topics
| |
Aight. I have a query regarding File I/O : [CODE]// Keep reading the file in a loop for some 100 seconds.. for (int x=0; x<100; x++) { // Code for reading file - say readFile() Thread.currentThread().sleep(1000); /* sleep for one second */ }[/CODE] Now, I need to read a file … | |
hi, i am looking for simple method to copy more than 2/3 arrays into one array.. so far i just learn to copy only two arrays at a time.. [CODE]String[][] data=new String [10][]; String[] column={"Name", "Age", "Sex"}; String[][] first={{"Calvin", "male", "23"}, {"Kathy","female","21"}}; String[][] second={{"Ravi","male","26"},{"Jesan","male","25"}}; String[][] third={{"Jacky", "male", "32"}, {"Jami","female", "23"}}; … | |
[CODE]client.java:18803: orphaned case case 130: // Clicking some stuff in game ^ client.java:24856: illegal start of expression private int somejunk; ^ client.java:24948: illegal start of expression public int EssenceMineX[] = { 2893, 2921, 2911, 2926, 2899}; ^ client.java:24949: illegal start of expression public int EssenceMineY[] = { 4846, 4846, 4832, … | |
Hi, I'm having trouble with...I don't know, either choosing the correct loop to use or maybe using the one I need but having it incorrectly placed. Right now, the program will give the "Invalid item number" message from my else statement if I enter an invalid value in the first … | |
Hi, I've been working on this program for nearly two days straight and I just can't get it quite right. So it's supposed to get input from the user and apply it to a switch statement. There are 5 cases that represent the cost per item for each case. Then … | |
I have my calculator GUI to display as I want it too. When I put in my mortgage amount and choose an option from the drop down box and hit calculate everything works as it should but when I try to manually put in the terms and interest rate and … | |
Hi all, I'm working on a Hanjie solver and this is part of the code. Everything else seems okay but I always get an error when I run it. Eclipse (i'm using Galileo version) points the exception to be at: [CODE] char a = combo1.get(i).charAt(i);[/CODE] combo1 ...refers to a List<String> … | |
So I have junit tests, let's pretend this is my code: [CODE] @Test public void test1() { Object o = new Object("123"); AssertTrue(o.string == "123"); } @Test public void test2() { Object o = new Object("456"); AssertTrue(o.string == "456"); } [/CODE] Let's pretend the code has a public string field … | |
Hi all [CODE]import java.io.*; public class POManager { private static String posFname = "C:/ITM200/OOP-Advanced-Topics/src/po.txt"; private static String taxposFname = "C:/ITM200/OOP-Advanced-Topics/src/tax.txt"; public static void main(String [] args) throws IOException { PO[] pos = readPOFile(); writePOTaxFile(pos); } public static PO[] readPOFile() throws IOException { BufferedReader in = new BufferedReader(new FileReader(posFname)); in.readLine(); String … | |
Hello! I am working through some program to auto-print files to a post script printer via the LPR command. The entire program is running, going through directories, finding the files, then deleting the files. Before deleting the files, though, I added in a section to try and print the files … | |
import java.io.*; import java.util.*; public class Reverseing { public static void main(String[] args) throws Exception { File f = new File("backwards.txt"); Scanner finput = new Scanner(f); String sentence = "", s = "", r = ""; while(finput.hasNext()) { sentence = s + finput.nextLine(); } ArrayList<String> lines = new ArrayList<String>(); ArrayList<String> … | |
Hello I am trying to figure what kind of code that would be needed to add a JTabbedPane to an JInternalFrame. I have 7 tabs added now (as many as I need) they are added by simply adding(hard coded) the "text name" to an array and every time the program … | |
Does anyone know how to put an Image in a Box Layout...just beside the buttons....Pls post me the code if anyone knows it? | |
Hey guys, I am trying to store a varying number of coordinate points in an array. So i thought of a list, and declaring this list as an arraylist using the Point class. Make sense so far? Or am i incorrect already? In doing so i came up with this: … | |
Hi guys, I've hit a problem I'm hoping someone can help me with. I'm trying to create a little irc bot application, just to learn how to use sockets in Java. Everything works fine so far up to the point where I try to pass the data coming from the … | |
I have to write a program using accessors and mutators and a constructor that stores a savings account's annual interest rate and balance. The class constructor needs to accept the amount of the savings account's starting balance. The class needs to have methods for subtracting withdrawals, adding deposits, and adding … | |
hello I'm trying to make a program that allows you to return and calculate the shortest common supersecuence using dynamic programming. The basic ideas of supersecuence common Shortest to search a given set of strings for example L, the smallest chain, which is one for each string supersecuence L. the … | |
we r making an image viewer for our mini project....n we hav tried doing it on our own ..but we are able to show only 1 image ...how to show many images using say 10 images in database?? we want functionalities like easy preview of next / previous image from … | |
is there any sample of java topological sort algorithm based on minimal vertex method. I also need to implement the ADT graph using adjacency lists representations | |
This particular snippet will display a chessboard in a new frame. Needless to say save it in a file named "chessboard.java". | |
basicallt i want to make a simple quiz...and the quiz contained 20 questions...but i have no idea in looping the question...so can anyone help me? [CODE]import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.Random; class Quiz extends JFrame implements ActionListener{ private JButton submit,next; private JTextArea text; private JTextField answer; private JLabel … | |
hello everyone i have created a text editor using java swings, my problem is that sometimes all features are working perfectly and sometimes they are not.... i wrote the entire program in one file and the no. of lines in it are 1770,is this a problem for that kind of … | |
import java.util.*; public class KeywordSearch { Scanner input = new Scanner(new File("keyvalues.txt")); Map<String, Integer> wordCountMap = getCountMap(in); for (String word: wordCountMap.keySet()) { int count = wordCountMap.get(word); while (input.hasNextLine()) { line = input.nextLine(); numLine++; Scanner word = new Scanner(line); while (word.hasNext()){ String nextWord = word.next(); numWord++; numChar = numChar + nextWord.length(); … | |
import java.util.*; public class Dice { public static void main(String[] args) { String strInput; Scanner console = new Scanner(System.in); System.out.print(" Please enter desired sum: "); do { Random r = new Random(); int count = 0; int dice1 = 0; int dice2 = 0; a = random number; b = … | |
Hi everyone, I am doing a program here to ask question about alphabet, and i am only in the middle of it and i face some problem that i really cant solve, need some help here... ok the problem is, for(int j =0; j<20;j++), in output, the 1st jlabel.setText(j) is … | |
Here is my code for word count from command line. Ive got it reading what is in the command line but its not reading the file it just reading the words from the command line. [CODE]import java.io.File; import java.io.FileNotFoundException; import java.util.*; public class WordCount { public static void main(String[] args) … | |
Hi Everyone, I am searching the most effective way of sorting a list of objects. Say i have a bean [CODE]public class MyClass { private string name; private string id; // Getters and setters } [/CODE] Now say we put some values in a List [CODE]List<MyClass> myClassList = new ArrayList<MyClass>(); … | |
Hi all! I'm making an MMO in Prof. Mark Overmars' GameMaker 7. I am making an applet for it, which I will embed into a webpage. When loaded, the applet will execute the .exe which will be stored in the same directory. Anywho, I want to make a loading bar … | |
Hi all, I have a question that , can we use java program as c++ program? Means, when we compile a c++ program we get a .exe file and we can run it anywhere or send to any one. Is the same possible in Java? As I know java creates … | |
Hi guys I would like some help with creation of Java ME class I have only been capable of coming up with the peudo-code Can someone please assist? Thanks CLASS ImageGetter Method 1: CREATE a connection to a remote server to request the image Method 2: RECIEVE the image and … |
The End.