32,204 Topics
| |
Hi, This code doesn't seem to compile. I can't seem to figure out what's wrong with it. The error I get is: **cannot find symbol - method contains (java.lang.string)** public void getName (String name) { for (olympian filename: Olympians) { if (filename.contains(name)) { System.out.println(filename); } else { System.out.println("Nothing found"); } … | |
Still playing with multi-threading and Prod-Con, at this point I've been at this for days. Would love some help debugging; thanks in advance. http://pastebin.com/jhHB9kTY - Main http://pastebin.com/BZSspf3x - Consumer http://pastebin.com/ndzAADJz - Producer http://pastebin.com/p7YdzH1D - Product http://pastebin.com/rxs3WzDT - Message http://pastebin.com/JR5ywgz1 - Utiliy 2 Producers, 4 Consumers Essentially Producers push a message … | |
I am writing code in java to support a working database. What I mean by that is I will have linked list store the data(I plan to change later) and use a parser to break down sql statements in turn interacting with the linked list. The question I have is … | |
Hi, Why does this piece of code throw me an error saying: **cannot return a value from method whose result type is void**? public void orderTotal() { int total; for (Order filename: Orders) { total = filename.getQuantity(); } return total; } | |
Hi folks. I am in search of automated swing builders (stylish jframe builders). Basically like IDE's. Yeah I am well familiar and bored of this netbeans, eclispse, etc. Can anyone suggest me some tools that will create some cool and **stylish** jframes or swings by just drag and drop.. I … | |
i need help to write a code for the folllowing question. A realtor wishes to track her commissions of house sales. The information that she collects is as follows: house address a string house type a string ( split level, bungalow, etc.) sale price a double She wishes to calculate … | |
hi every one =) I just started to learn trees in java but I am kind a lost with it is implementation I need to understand implementing and tracing methods useing tree interfaces please post any recommended source , tutorial or lecture thank you | |
Hi, I was creating clone of breakout and got the game working correctly. But after setting up menu my keyboard doesnt respond anymore. But if I launch game directly without Menu class keys are working perfectly. Where the problem might be? Here is the full source code. VBreakOut.java package net.viped; … | |
The code below compares three numbers and it prints out the Maximum and Minimum value, let me hope it will rescue somebody :) import java.util.Scanner; public class MaxMin { public static void main(String args[]) { int w,x, y; System.out.println("\n\nTHE PROGRAM BELOW CALCULATES AND OUT PUTS THE MAXIMUM AND MINIMUM OF … | |
Hello, I'm in a pickle. (Please observe the code) In the actionPerformed method, I don't know how I can get the value of the variable 'minutes'. I can get 'hours' by e.getActionCommand(), but can't do minutes that way. I need to get both 'hours' and 'minutes' at the same action. … | |
Consider the following: for (int counter = 1; counter < 1; counter -) How many times will the loop execute? | |
I have a Java class called Term holding polynomials like below public Term(int c, int e) throws NegativeExponent { if (e < 0) throw new NegativeExponent(); coef = c; expo = (coef == 0) ? 1 : e; } I also have an equals method in the same class like … | |
Hi, I'm having some trouble writing a method to sort a LinkedQueue ADT. I find it difficult to keep track of the order things when sorting is concerned (ha ha ha). I'm trying to pull the values out of a Queue which store objects of type PrinterItem. Those objects in … | |
I am making a project using hashtables. I have to use a linked list to handle duplicate hashcodes. The Objects that I am turning into hash tables are State objects with just a String name. I have debugged and tested my entire project and cannot figure out why it is … | |
Hi all - I need to read a text file using a scanner class that has the following format: 5 5 5 5 5 5 5 0 0 0 0 5 5 5 0 5 5 5 0 0 0 5 5 5 5 0 0 2 0 The first … | |
Hi, I am creating a simple game and I my game thread and my player2 thread seem to be executing twice each time the Thread.Sleep() expires. This is the output: Starting game: Player 2 thread Game thread Starting game: Player 2 thread Game thread Player 2 thread This is the … | |
Hi guys, i dont think im using the boolean and break correctly i need it to see the tutormin>=240 and then throw the error and stop without exiting the program. can someone take a look and help me edit it import java.awt.*; //imports all Java.awt import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import … | |
Using java, I need to parse a json text file that will contain data according to the layout shown below. The number of email addresses per store will vary. The point is to get a list of stores & corresponding email addresses, then send emails to the addresses. I have … | |
Hi, I am really struggling with a bufferedReader method i am trying to implement. I have to read text from a file like this : Poland Franciszek,Smuda,63,2009 1,GK,Wojciech,Szczesny,22,11,0 2,DF,Sebastian,Boenisch,25,9,0 3,DF,Grzegorz,Wojtkowiak,28,19,0 4,DF,Marcin,Kaminski,20,3,0 5,MF,Dariusz,Dudka,28,65,2 6,MF,Adam,Matuszczyk,23,20,1 and store it in an array of objects (mine being an array of Player objects which stores … | |
Hi everyone, I've been trying to turn one of my programs into an executable application, but every time I click the jar file or open it using the command prompt nothing happens. I was wondering if I shouldn't be using "System.out.println" and Scanners to take input/display output. I am using … | |
I keep getting a .class expected error in the if statement. help please. private int[] hand; private int[] play; public PokerHand(){ this.hand = new int[5]; } public boolean haveCard(int card){ if (play[] == card) return true; } public void displayCards(){ System.out.println(hand); } public void dealCards(){ | |
Does a Java applet have to contain a "main" method or does it run from the "init()" method. I have written a small game in java following and example in a book however it does not tell you how to run the damn thing. Code has no erros from what … | |
Hi everyone, We all face dificullity in coding recursivly, maybe most of new codders and CS students. However, **my question today is related to How many number of execution been made by the recursive method.** Which I think a bit tidious. I'll be updaing this article with new questions any … | |
Hi, I have been asked to create a method to store information on the football players for the polish team. I have stored each player in an array of Players[]. My task is to output any players which match the search string. So the method I have to create is … | |
I'm probably doing this wrong, because there has to be a way to do this. Here is my current code: import javax.sound.sampled.*; public class soundHandler{ soundHandler() { } public void newSound(String sound) { new soundThread(sound).start(); } } class soundThread extends Thread { String soundName; Clip clip = null; soundThread(String i_soundName) … | |
I am trying to create a checker program(for a sudoku puzzle) that will read a completed board and then go to determine if it obeys the constraints. If it does, it just says so, if it doesn't it reports the conflict. Where should I start? Thanks. | |
Hi, I'm working on an assignment where I have to convert military time to standard time. I think I mostly have it solved except for when the minutes are between 0 and 10. For example, 909 should read 9:09 am, but it prints 9:9 am. I'm not sure how to … | |
Hi, Can anyone tell me what is wrong with this code? It seems to be throwing me some error: **non-static method getName() cannot be referenced from a static context.** public void printOrders() { for(Order filename: Orders) { System.out.println("Name: " + Order.getName()); System.out.println("Quantity: " + Order.getQuantity()); } } | |
Hi, not too sure if Web Development is the right place for this but anyway: I've never done any web development and I have never created a Firefox extension either but here's the thing: I am making a project for myself, a Java (not JavaScript!!!) program that can add, change … | |
Is it possible to remove an Icon or ImageIcon once it is set to a JButton or JLabel? When a specific action in my program has taken place, the picture in no more appropriate and I want to remove it from a JLabel. |
The End.