1,963 Posted Topics

Member Avatar for nanna

You need a for-loop inside the while statement. The upper limit of the loop will be the input you give

Member Avatar for javaAddict
0
162
Member Avatar for stilldancin12

[QUOTE=masijade;709304]Well, 1. That's already been said. 2. The OP has declared the problem solved. 3. You didn't notice that today was declared [inlinecode]today=new date()[/inlinecode] rather than [inlinecode]today=new Date()[/inlinecode].[/QUOTE] And 4. This thread is 15 days old. Try to solve more current threads

Member Avatar for javaAddict
0
136
Member Avatar for tortoiseman

I have search the java.awt package and didn't find the class Picture: [URL="http://java.sun.com/javase/6/docs/api/java/awt/package-summary.html"]java.awt[/URL] I don't believe that it is a class that the JDK has. Try search it in the internet and you will find plenty Picture classes implemented by others

Member Avatar for tortoiseman
0
121
Member Avatar for k2k

[CODE] while(option!=9) { Name nameBox[]= new Name[500]; } [/CODE] You create a new nameBox every time you repeat the loop, so the first time you are in the loop you give values to the [B]local[/B] nameBox, but when the loop executes again, you create again a new nameBox (new Name[500]) …

Member Avatar for javaAddict
0
188
Member Avatar for Grub

[QUOTE=peter_budo;707575]If my sleepy mind does play tricks on me, you should do it as [code](File)vector.elementAt(i).getAbsolutePath()[/code][/QUOTE] I think, although it needs to be checked that you should do this: [icode]((File)vector.elementAt(i)).getAbsolutePath()[/icode] Just a suggestion, I don't know if it will work, just try it, because resizing the array is bad idea. Every …

Member Avatar for Grub
0
120
Member Avatar for chenessa

Create an object StudentInfo with attributes the name, the grade, and a boolean that indicates if the student has passed or not. Read the file like this: [CODE] BufferedReader reader = new BufferedReader(new FileReader("fileName.txt")) String input = reader.readeLine(); [/CODE] [URL="http://java.sun.com/javase/6/docs/api/java/io/BufferedReader.html"]BufferedReader[/URL] The lines of the file will have each one of …

Member Avatar for javaAddict
0
152
Member Avatar for LiquidCobra

I think this: double numberOfMonths = (principal + totalInterest) / ( [U]monthly payments[/U]) Should be: double numberOfMonths = (principal + totalInterest) / ( [U]MonthlyPayments[/U]) And weren't you taught in math class the algorithm?

Member Avatar for stultuske
0
144
Member Avatar for redZERO

Create a class like this: [CODE] class DataClass { public int intValue; public String strValue; public DataClass() { } } [/CODE] And: [CODE] DataClass arr [] = new DataClass[2]; arr[0] = new DataClass(); arr[0].intValue = 0; arr[0].strValue = "value 0"; arr[1] = new DataClass(); arr[1].intValue = 1; arr[1].strValue = "value …

Member Avatar for Ezzaral
0
112
Member Avatar for Grub

You could compare the bytes you get from reading the file, but I have never used that way and I don't know how it will work. As far as the almost identical you will need to decide the ruling. [URL="http://java.sun.com/javase/6/docs/api/java/io/BufferedInputStream.html"]http://java.sun.com/javase/6/docs/api/java/io/BufferedInputStream.html[/URL] [URL="http://java.sun.com/javase/6/docs/api/java/io/BufferedReader.html"]http://java.sun.com/javase/6/docs/api/java/io/BufferedReader.html[/URL] [URL="http://java.sun.com/javase/6/docs/api/java/io/ByteArrayInputStream.html"]http://java.sun.com/javase/6/docs/api/java/io/ByteArrayInputStream.html[/URL]

Member Avatar for javaAddict
0
127
Member Avatar for rathinam86

[URL="http://www.andykhan.com/jexcelapi/tutorial.html"]http://www.andykhan.com/jexcelapi/tutorial.html[/URL] This basic tutorial should be enough to understand that the link supplied by [I]masijade[/I] has what you need to start. Guess you didn't bother to give a closer look to the API and search what you need. If you have written code using the API and got stuck somewhere …

Member Avatar for javaAddict
0
324
Member Avatar for stefen04

This is not java. And during your class, have you learned to write classes with main method and run the "Hello World" program? [CODE] class Hello { public static void main(String [] args) { system.out.println(Hello World); } } [/CODE]

Member Avatar for javaAddict
0
123
Member Avatar for Mackjan

first of all this: [I]sides = mSides;[/I] should be like this: [I]mSides = sides;[/I] And the error you get is because the method: mRandom.nextInt(mSides) doesn't take as argument a negative or zero number; as the error message says it must be positive. The reason you get the error is because …

Member Avatar for Mackjan
0
103
Member Avatar for janustt

Java is case sensitive. When you declare an instance like this: Circle radius = new Circle(), this would be wrong: Area = Radius.getArea(). This is correct: Area = radius.getArea() Also you call a method: Circle.setRadius(number) and that method doesn't exist. On top of that if it did exist you should …

Member Avatar for janustt
0
122
Member Avatar for silentone190

[QUOTE=stultuske;704099]if you are trying to get (for instance) the total of amount for the customers, just insert your customers in an array and loop over that array getting the amount you want for instance: [code=Java] double total = 0; for( int i = 0; i < customers.length(); i++ ) total …

Member Avatar for silentone190
0
175
Member Avatar for ymf
Member Avatar for peter_budo
0
194
Member Avatar for PoovenM

I assume that the other program (GUI) has a list of classes. Do you know the elements of those classes as well as their methods. If the main GUI page has a constructor you call it with the appropriate data that you get from your program. If the elements of …

Member Avatar for PoovenM
0
127
Member Avatar for defychaos

What the 3 variables of LProp stand for? If they are the 2 bool values and the which method to call then have an if statement checking what is the 3rd input and call appropriately the reight method AND, NOT, ... with the first 2 arguments

Member Avatar for javaAddict
0
105
Member Avatar for teh noobshow

Can you sent a sample of you java code, because I don't understand what you mean when you say: [QUOTE]My way of coding is more simpler than the public boolean and public void.[/QUOTE] [QUOTE] but in the class file it's everything in the java file but with a symbol. So …

Member Avatar for javaAddict
-1
100
Member Avatar for rakesh.mk

Next time be more clear about what is your problem. From what I understood you don't know how to get and use the username from the comboBox? If yes assume that you have a String username variable. For getting the value from a comboBox that has String elements do this: …

Member Avatar for peter_budo
0
157
Member Avatar for Gerbilkit

The name of the file must be the same as the name of the class and as the name of the constructor. That is why in java terminology we don't say 'file' but 'class' Is the name of the file: EmployeeSystem ? Then this : [CODE] public class EmployeeDirectorySystem { …

Member Avatar for Gerbilkit
0
108
Member Avatar for chicago1985

[QUOTE=chicago1985;701683]I have a Form input field in my JSP:[code] <input name="nickname" type="text" value="<%= NameClass.getInfo() %>" /> [/code] How do I make sure this data is escaped correctly to be able to show quotes and apostrophes. I tried slash in front [b](name=\"nickname\")[/b] and it didnt work. I dont have JSF,Struts, JSTL, …

Member Avatar for javaAddict
0
90
Member Avatar for cproud21

[CODE] mport java.util.Scanner; public class ClockDemo { public static void main (String[] args) { Scanner keyboard = new Scanner(System.in); System.out.println("Enter the Current time Hours: "); int currHours = keyboard.nextInt(); System.out.println("Enter the Current time Minutes: "); int currMin = keyboard.nextInt(); TimeAT current = new TimeAT(currHours, currMin); } [/CODE] The same way …

Member Avatar for javaAddict
0
66
Member Avatar for cproud21

Write a Clock class which uses TimeAT class objects to store the current time and an alarm time. The Clock class should have 3 constructors: - A no-arg constructor - A constructor which takes one TimeAT object as an argument and sets the current time - A constructor which takes …

Member Avatar for javaAddict
0
131
Member Avatar for tonymate

If you have provided with java code, we could help, even if the code was wrong. But if you have written it in another language, what do expect us to do? Write the entire application just to tell you that: Yes, it works in java!

Member Avatar for javaAddict
0
131
Member Avatar for clueless101

First of all the assignment is very wrong. The idea is to learn OOP. As other have understood your teacher should have said to create an object Student with the elements required and have an array of Students. The way your code is written I would suggest all of your …

Member Avatar for VernonDozier
0
174
Member Avatar for Atif Azmi

[CODE] int i=0; switch (i) { case 1: System.out.println("Value 1"); break; case 2: System.out.println("Value 2"); break; } [/CODE] The code checks 'i''s value. When it finds a case that has that value, it executes what is under it. So the above code will print: "Value 1". Then break will be …

Member Avatar for stultuske
0
96
Member Avatar for adiel224

Actually [I]adiel224[/I] even forgot to close the bracket :D This will not compile: [CODE] public void update(....){ //complete here ..... [/CODE] This will: [CODE] public void update(....){ //complete here //..... } [/CODE] And that is the only help you will get after such post

Member Avatar for stultuske
1
85
Member Avatar for W@n

Are you allowed to use these classes provided by java: java.util.Vector java.util.ArrayList ? If yes then things are much easier

Member Avatar for W@n
0
3K
Member Avatar for Tyster

First of all static methods are called this way: BankAccount.setName(accountName) I hope that your methods are not static. Second with this code, you create 2 new instances, when you need 1. You will need to have 1 instance and modify its values. [CODE] for(i = 1; i < totalAccounts; i++) …

Member Avatar for Tyster
0
97
Member Avatar for codered152

The second window will have a conwstructor that will take as argument the first window: public Frame2 (Frame1 f1) The Frame1 (first window) will have variables that will take value from the second window when you click 'Add'. When you click 'Add' from the second window you will give values …

Member Avatar for Ezzaral
0
85
Member Avatar for ajithraj

If there isn't, why don't you create one, and post it on the Internet for others to take it. Isn't this what you are asking from the others?

Member Avatar for javaAddict
0
84
Member Avatar for letlet_pogs

The concept of stack is not unique in java. It applies not only in the programming world but everywhere, so I will explain the basic concept. When you put items in a stack you place each one of them after the other. But when you try to take these items …

Member Avatar for letlet_pogs
0
347
Member Avatar for abhi_elementx

Try posting part of the code, and try putting a System.out.println() in the mouseclicked event before you call the function. Personally I prefer actionEvents for just clicking

Member Avatar for fireheart1024
0
123
Member Avatar for ezkonekgal

The problem is in the evaluatePostfix method, as the error says. Probably because the program goes to else if { ... } and you try to do a int op1 = stack.pop() If the stack is empty how can you pop something from it? First check if the stack has …

Member Avatar for ezkonekgal
0
132
Member Avatar for daniel50096230

>cboStart.addItem(new Integer(1)); >boStart.addItem(new Integer(2)); // and so one to 12 >cboStart.addItem(1); >cboStart.addItem(2); // and so one to 12 > > >Use any of these two methods. > >Regards, >PuneetK The: cboStart.addItem(new Integer(1)) will add Integer objects to the ComboBox and you will have to cast them to Integer when you …

Member Avatar for javaAddict
0
156
Member Avatar for ocreds

By the way, I don't agree with the way the ParserException is written. This is not the right way to extend the Exception class

Member Avatar for javaAddict
-2
292
Member Avatar for knarffrank

If you don't know java why are you starting with gui when you don't know even the basics of the language? Start by writing simple console programs and learn how to use classes, extending them . . .

Member Avatar for stephen84s
0
122
Member Avatar for maunikdesai

As the error says you have probably forgot to put somewhere a ")" And if you can't debug something that simple or you don't know how to pass arguments, what are you doing writing that complex code (for you skills)? How many programs that are executed from console have you …

Member Avatar for Ezzaral
0
201
Member Avatar for nojtb

Here is an example for your problem followed by a link from this forum: Static: [CODE] class Test { public static printMyName() { System.out.println("My name IS NEO"); } public static void main(String [] args) { printMyName(); //or Test.printMyName(); //both will work } } [/CODE] Non Static: [CODE] class Test { …

Member Avatar for nojtb
0
138
Member Avatar for Tootlol
Member Avatar for pentiumpablo

Where are you having problems. For reading command line I use something like this: [CODE] BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter set of values:") String input = keyboard.readLine(); [/CODE] If you enter: 3 4 Then the String input will have this value: "3 4" So you can do something …

Member Avatar for javaAddict
0
105
Member Avatar for javaAddict

I presume that by back button you are referring to a browser and you have implemented that with JSPs. In that case when the username and password are correct, save the username in the session before you redirect to the next page. Then when you go to the next page …

Member Avatar for javaAddict
0
134
Member Avatar for kevinpeterson22

Where do you get the errors? (at which lines) Post part of the code where you get the error, with the error message

Member Avatar for jaka.ramdani
-1
140
Member Avatar for subscribeid

Since you created it dynamically using java, then you can the values that you displayed and write a method that take these values and store them in the database. If the values, are user inputs then use the <form> tag and submit the form to another jsp, take the values …

Member Avatar for peter_budo
0
1K
Member Avatar for newtechie

Use the BufferedReader class with stultuske's code. This class contains the readLine() method you need

Member Avatar for newtechie
0
120
Member Avatar for Ajaxx

Aren't you going to tell us where is the error? And probably you are using a method that doesn't exist

Member Avatar for peter_budo
0
305
Member Avatar for balakrishnan.kb

These methods and variables don't need an instance of the object to be used: If in an object: MyObject there is the static variable: VAR and the static method method1(), then instead of: [CODE] MyObject my=new MyObject(); String s = my.VAR; my.method1(); [/CODE] you can also do this: [CODE] String …

Member Avatar for balakrishnan.kb
0
267
Member Avatar for kevinpeterson22

JSPs have nothing to do swing. (That was my first mistake). Meaning that you cannot modify your code to convert swing to JSP. The only thing you can keep the same are the classes. Everything that is GUI related has to go. Which is why we don't implement too much …

Member Avatar for javaAddict
-2
305
Member Avatar for geex

[QUOTE=Alex Edwards;682679]When will you ever say yes, or turn off your email blocking??? When will the madness stop??? =P[/QUOTE] Madness? This is SPARTA. PS: And I am from Greece

Member Avatar for javaAddict
0
122
Member Avatar for crotty99

In the class: ClassRecord have you implemented (overridden) the method toString() ? If not then when you call this: [CODE] pw.println(theList.toString());; [/CODE] since you have no toString() method you call the toString() method of the super class. Yes, ClassRecord has a super class, the Object class. In final what you …

Member Avatar for crotty99
0
113

The End.