35,618 Topics

Member Avatar for
Member Avatar for COKEDUDE

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 …

Member Avatar for javaAddict
0
201
Member Avatar for Druyx

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 …

Member Avatar for Doctor Inferno
0
175
Member Avatar for LucarioWill

[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 …

Member Avatar for LucarioWill
0
3K
Member Avatar for Clawsy

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 …

Member Avatar for Clawsy
0
221
Member Avatar for hanntaa

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 …

Member Avatar for hanntaa
0
105
Member Avatar for rukshilag

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 …

Member Avatar for darkagn
-1
86
Member Avatar for hanntaa

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 …

Member Avatar for hanntaa
0
210
Member Avatar for Pranesh_Ashrit

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 …

Member Avatar for masijade
-1
83
Member Avatar for silveram

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 …

-3
50
Member Avatar for gitech

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 …

Member Avatar for gangsta1903
0
91
Member Avatar for saikatroy1985

As i am new to jsp, i need a solution for to connect login page with the database which is having username and password.

Member Avatar for peter_budo
1
99
Member Avatar for saurabhjj

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 …

Member Avatar for peter_budo
0
31
Member Avatar for Clawsy

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 …

Member Avatar for Clawsy
0
270
Member Avatar for jainshammi
Member Avatar for Thirusha
-1
51
Member Avatar for shashikant.v

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

Member Avatar for peter_budo
0
65
Member Avatar for nobodycool

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 …

Member Avatar for javaAddict
1
143
Member Avatar for jamojo

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, …

0
80
Member Avatar for sahity1a@yahoo.

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 …

Member Avatar for javaAddict
0
100
Member Avatar for bkafroboy69

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 …

0
64
Member Avatar for .11

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("" + …

Member Avatar for adams161
0
103
Member Avatar for Clawsy

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 …

Member Avatar for adams161
0
234
Member Avatar for NewbieProgram

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] = …

Member Avatar for adams161
0
759
Member Avatar for nonshatter

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 …

Member Avatar for ~s.o.s~
0
111
Member Avatar for sachinarora

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

Member Avatar for kvprajapati
0
98
Member Avatar for adams161

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 …

Member Avatar for adams161
0
105
Member Avatar for ibanez270dx

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 …

Member Avatar for ibanez270dx
0
5K
Member Avatar for tabooxchanz

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 …

0
60
Member Avatar for doobiez

[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 …

Member Avatar for masijade
0
149
Member Avatar for Stefano Mtangoo

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[]){ …

Member Avatar for Stefano Mtangoo
-1
327
Member Avatar for anevins

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 = …

Member Avatar for donaldw
0
112

The End.