35,618 Topics
![]() | |
Can someone please tell me why "int can not be dereferenced" here. contents += cart[i].toString() + "\n [CODE]// ********************************************************************** // ShoppingCart.java // // Represents a shopping cart as an array of items // ********************************************************************** import java.text.NumberFormat; public class ShoppingCart { private int itemCount; // total number of items in the … | |
Hi Daniweb I'm not really new, I've been lurking on the site for a while now, and I've suddenly felt the urge to start contributing. Of course I need to actually have something worth while to contribute.... Anyway, I'm java and C++ programmer (depending on what I'm working on) and … | |
[CODE]import java.util.Scanner; public class MathTutor { Scanner input = new Scanner(System.in); int numQuestions; int choice; int numCorrect; public MathTutor (){ numQuestions = choice = numCorrect = 0; } public int getNumQuestions(){ { System.out.print("How many questions? "); numQuestions = input.nextInt(); if (numQuestions < 1) { System.out.println("Invalid - must ask at least … | |
Hi, I first convert the image on the server application in bytes: [code] //server public void sendImage(File file) throws IOException { ByteArrayOutputStream baos=new ByteArrayOutputStream(1000); BufferedImage img=ImageIO.read(new File(file.getAbsolutePath())); ImageIO.write(img, "jpg", baos); baos.flush(); os.write(baos.toByteArray());// this is a "new DataOutputStream(clientSocket.getOutputStream());" System.out.println("Done! Length is:"+baos.toByteArray().length); baos.close(); } [/code] Then my application freezes when trying to … | |
im using a JFileChooser to find a file from anywhere on the system and load it but i also need to be able to export the data within my program to an unknown location, how would i go about doing that?? is it simular to the JFileChooser? any help would … | |
I am a beginner to java and i find it very difficult. can someone please help and tell me how you identify a main method in an application and also how do i make a jbutton call a certain method and output it to a text field? please explain with … | |
Hey guys iv got this project to make an address book that has all kinds of functions and iv got them all working apart from one bit, it needs to be able to read a file when it opens as well as import other data from other files. The data … | |
I have used crypto class of javax to encrypt and decrypt the string. It works fine for few cases but for few it returns null. I am not getting the exact reason for this. kindly guide me. Here is my code[CODE]public String decrypt(String str) { try { // Decode base64 … | |
I need a java code or algorithm for converting eNFAs to NFAs. This is our project for our automata theory class and our prof said that it would be alright to get codes from other people as long as we fully understood how the program works. Please help me and … | |
Hai Friends, Iam using swing application in my project with short cut keys to perform some action, it takes few seconds to process(retrieve data from server to client) ,when i press the shortcut key for three times means the action is performing thrice, i want to perform single action.is there … | |
As i am new to jsp, i need a solution for to connect login page with the database which is having username and password. | |
hi, I have written my first pom.xml and on making a build it says, u are using java 1.3 you need 5 or above. I only have 1.6 installed in my system, Can anyone please help me, please tell me where do I need to check, I have checked all … | |
Hello, I'm working on a bluetooth chat application project called 'BlueChat'. I coded the server (BServer.java) and client (BClient.java) parts (2 separate threads). The visual part is called BlueChat.java and allowes the user to select to be the server or the client. I wrote a lot of System.out.println("")'s to check … | |
hi dear, I am also doing the same project . Could you help me | |
dear friends, I am working on small project for that i am making a setup from install creator and launch 4j after creating a jar file. But in that step .exe file is needed . pls help me to create a .exe file. thanks & regards shashikant | |
Hello there, I am working on an assignment for school and I am having a hard time understanding the concept of an array of objects. I am required to create an array of Music objects so that I can search through them via a binary search and make changes as … | |
Hello everyone, I created a Java Class that retrieves files in a specific local drive\folder. Then I was able to retrieve it from the JSP page. Can I ask what is the best approach to create a JSP recordset paging (previous, next, page 1,2,3...) without using the database? For example, … | |
I need to make a sorting algorithm. The program takes an input file that stores the information into an array: the array has student's name and a personality type. The personality types are: enum values Realistic Artistic Social Conventional Then once it takes an array, it sould divide the main … | |
these are all my codes and im trying to make shapoes in myshapetesrer2.these are the directions i have to follow but i dont kn ow if i did tem right any help? Write an abstract class: ColoredShape A ColoredShape has a position (x and y coordinates that are integers) and … | |
Hey I want to simulate a knight moving in my Knight Tour Gui, this is the display code, the moves are stored in the arraylist moves. [CODE] public void display() { for(int i = 0; i < moves.size(); i++) { //Gets the correct button JButton button = square.get(moves.indexOf(i+1)); button.setText("" + … | |
Hello, I'm trying to develop a chat application [I]over internet[/I]. First I want to send just strings... later files. I want to have a client that is a java applet that connects to the server - a java desktop application. I waould like to send files later over applet and … | |
I'm having problems generating CPU turn; preferably with AI, and also draw between player and CPU. [CODE] jButton1.setEnabled(false); boolean Userturn = true; JLabel[] label = new JLabel[9]; label [0] = jLabel1; label [1] = jLabel2; label [2] = jLabel3; label [3] = jLabel4; label [4] = jLabel5; label [5] = … | |
Hey guys, basically what i'm trying to do is take each line from two text files and store them into two variables, salt and original. I then want to pass these 2 variables to a different method called: crypt(String salt, String original) How would I go about doing this? Many … | |
hi, i have seen a code through some body on this site and apply it , it was working correctly but it no not on the site know can anyone please tell me the code of it ,the code was about 60 lines long | |
Hi, i've started making a simple breakout game with java swing. This is just for fun and to learn more about java and swing. I got a frame and a panel and a mouse listener. I draw a paddle on the screen and it moves as the mouse moves. I … | |
Hey guys, I've very new to JSP, Java, and Netbeans and I'm having an issue... So I've got an ArrayList of User objects and I'm trying to iterate over the list in a JSP page to display the info. I've included the JSTL 1.1 jstl and standard libraries. Here is … | |
Fellow Java Coders, I recently got a project to do for my coursework in university which requires that me and my group members simulate a file manager similar to windows explorer but I guess not as complex. Here is a synopsis of what is required: The members of this group … | |
[quote] I'm having a problem with constructor. I get an error an error "invalid method declaration; return type required" on line 75 ..here is line 75 TypeOfStudent(int minAge, int maxAge, String name) ..and I've posted my whole code below[/quote] [CODE]import java.util.*; public class Student { private String name; private int … | |
Hi, I have done this code to learn ArrayList. I keep getting errors. Basically I want to accumulate names in list and when user types 'n' at prompt, it prints out names. What is wrong? [CODE=java]package mtangoo; import java.util.ArrayList; import java.util.Scanner; public class MainClass { public static void main(String args[]){ … | |
Hi, i'm learning java and I don't know why I'm getting this error. New Error on line 11 - "Cannot find symbol" [code] int first, second; int first, second; double firstcube, secondcube, power = 3, num = 3, pow; Scanner scan = new Scanner(System.in); System.out.println("Enter First Number: "); first = … |
The End.