2,777 Posted Topics

Member Avatar for apanimesh061

> how to add point of "Point" type Define an instance of a Point class object and pass it to the add() method: Point aPt = new Point(); points.add(aPt);

Member Avatar for NormR1
0
113
Member Avatar for Valiantangel

Please explain what you need a second loop for. What is the code supposed to do? What does it do now? One problem with your code is that it is not properly formatted. You should always use {}s with loops and if statement to contain the code within those statements. …

Member Avatar for prnjn
0
129
Member Avatar for GeekTool

Can you post the output from the code? One problem I see is there is no ending }s for the two {s

Member Avatar for prnjn
0
144
Member Avatar for sid78669
Member Avatar for DEAD TERMINATOR
Member Avatar for EPerminas

Where are you having problems with your code? Post the code and ask your questions.

Member Avatar for JamesCherrill
0
374
Member Avatar for EPerminas

What kind of an array? The String class has a method that will create an array from a String. Or create the array and use another String class method to get the characters one by one and store them into the array. BTW array indexes start at 0. L's index …

Member Avatar for NormR1
0
283
Member Avatar for erms

It is more usefull to see and work with a hexidecimal display of the RGB values instead of a decimal display. You will have to break the value 2000000 into its R G and B components so you can use them with the setRGB() method. > define the color for …

Member Avatar for NormR1
0
287
Member Avatar for Nicky1224

Please post the full text of the error messages. Post the program's current out put and add comments to show what is wrong with it and show what you want it to look like,

Member Avatar for sciwizeh
0
162
Member Avatar for millroy

Can you explain what you are trying to do? Most monitors are vertical to the plane where there would be a 360 degree view where North could be pointed to. My monitor faces East, the right hand is to the North and the left to the South. A GPS device …

Member Avatar for JGorard159
0
191
Member Avatar for vinnitro
Member Avatar for vinnitro

You should use the equals() method to compare Strings. Your if test using == compares two variables to see it they both refer to the same object. You want to get the contents of those objects as Strings and compare them.

Member Avatar for vinnitro
0
5K
Member Avatar for Nicky1224

Are you trying to write the program and have questions about how to do it or what are you looking for?

Member Avatar for Ezzaral
0
90
Member Avatar for kumaresen

> Error: The local variable word may not have been initialized Give the variable: word a value when you define it.

Member Avatar for NormR1
0
241
Member Avatar for swink
Member Avatar for NormR1
0
90
Member Avatar for Johannady2
Member Avatar for breakzzzz20
Member Avatar for sammoto

> variable letterGrade might not have been initialized" The compiler sees that there is a variable: letterGrade being used in the code that may not have been given an initial value. There is not an ending else clause following the chain of if/else if statements to guarantee the variable gets …

Member Avatar for jalpesh_007
0
130
Member Avatar for ravsau
Member Avatar for sciwizeh
0
754
Member Avatar for Johannady2

Try debugging the code by adding lots of println statements to the code that show the values of variables as they are used and as they are changed and to show the program execution flow so you can see what the computer sees and understand what your program is doing.

Member Avatar for NormR1
0
324
Member Avatar for Johannady2

Also the if statement requires a boolean expression inside of the ()s; A method defined as void does not return a boolean value.

Member Avatar for NormR1
0
438
Member Avatar for Soubhik

Try some testing. Load the same image in the new ImageIcon() calls and see if there is a problem with the java code vs the images.

Member Avatar for NormR1
0
186
Member Avatar for thanatos1

Are you asking about the location of a window on the monitor? There are methods for setting the location.

Member Avatar for NormR1
0
270
Member Avatar for GTech4life

Where are you going to draw the tree? Is this a console window or in a GUI? What class is the drawRectangle() method in?

Member Avatar for NormR1
-1
221
Member Avatar for vriend12345

Are you asking if the source code for a program can be changed while the program is executing? The number of nested loops would be specified in the source before it is compiled. What problem are you trying to solve?

Member Avatar for vriend12345
0
119
Member Avatar for anuj_sharma

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Courier New;}} {\*\generator Msftedit 5.41.15.1515;}\viewkind4\uc1\pard\f0\fs20 This is RTF\par } > if I open the document and add some text manually and save the file What program are you using? Open the file in another program like Notepad and see what it contains before and then after you add the …

Member Avatar for anuj_sharma
0
644
Member Avatar for Bladtman242

Do you have a small input file for testing? How did you code the hashCode method so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes?

Member Avatar for NormR1
0
3K
Member Avatar for Torf

Does it compile and execute? Is the output correct? That would be a way to see if it is correct.

Member Avatar for NormR1
0
155
Member Avatar for soham.m17

You will have to draw all the lines every time. Save the coordinates for the lines in a list and go through the list and draw the lines every time in the paint method. You should call the show_line() method from the paintComponent() method passing it the Graphics object. Or …

Member Avatar for soham.m17
0
214
Member Avatar for pendo826
Member Avatar for utkarshsahu

> choose a button that is not currently marked When you chose a button, test if it is marked (how are you marking the buttons) and if it is marked, chose another one. > how to randomly shuffle over elements in button array Use the Random class to chose the …

Member Avatar for utkarshsahu
0
130
Member Avatar for anuj_sharma

Read the API doc for the FileOutputStream class. Its constructor has an arg for appending to the file.

Member Avatar for anuj_sharma
0
1K
Member Avatar for daemonlies

> it just comes up with an exception error Please post the full text of the error message.

Member Avatar for NormR1
0
145
Member Avatar for woodenduck

What have you tried so far? Do you have any specific questions or problems? Please post them.

Member Avatar for NormR1
0
190
Member Avatar for mikekhd

Where is the paint() method? In a Swing app, you would call the repaint() method to request the jvm to call the paint method at some time a little later.

Member Avatar for NormR1
0
270
Member Avatar for jjoensuu

It depends on what you mean by validation. Correctly formatted email address. A name (no digits) A number(no letters)

Member Avatar for JamesCherrill
0
443
Member Avatar for hwoarang69
Member Avatar for stultuske
0
126
Member Avatar for whileiforelse

> how can I make the ''not found'' message print only once If you onlly want one message printed after the search ends, use a boolean variable (init to false) to record if a match is found(set to true). After the end of the loop if the boolean has not …

Member Avatar for whileiforelse
0
196
Member Avatar for anuj_sharma

Why do you think it is a class? Is it in a package that needs to be imported?

Member Avatar for anuj_sharma
0
368
Member Avatar for Torf

Does your code compile and execute without error? What does it print out when it executes? Post its output and Add some comments to the post saying what is wrong with the output. If you get errors, copy and paste the full text of the error messages.

Member Avatar for Torf
0
229
Member Avatar for Fotis_13

The array: array contains only Test2 objects. It does not contain either int or String objects. You must ask the Test2 object what it contains. Add methods to the Test2 class that will check for the contents that you want to test for. Then you can call those methods to …

Member Avatar for Fotis_13
0
206
Member Avatar for radhika1990

Your unformatted code is very hard to read and understand. Can you post code that is properly formatted?

Member Avatar for NormR1
0
191
Member Avatar for sonicx2218

Can you explain what you want to copy? Is it the image that is displayed on the screen? Use the Robot class to capture the screen and then write it to a disk file. What do you mean by "copies of the same applet"? Are you talking about java classes …

Member Avatar for sonicx2218
0
407
Member Avatar for javaprog200
Member Avatar for Stjerne

The JVM is probably moving the focus to where it wants it. What component has focus when the app starts? When does the code call requestFocus()? That method is not recommended any more (see the API doc). It recommends you use another method: requestFocusInWindow

Member Avatar for Stjerne
0
180
Member Avatar for Kathy0410

Please edit your post and properly align the code. The nesting of statements within {} should be indented 3-4 spaces. The posted code is not readable with all the statements starting in the first column. Can you explain what problems you are having with the code? Post the full text …

Member Avatar for NormR1
0
662
Member Avatar for cecsFTL

Try debugging the code by adding some println statements that show where the code is executing and the values of the variables as they change and are used. The output will show what the computer is seeing and what the code is doing.

Member Avatar for NormR1
0
137
Member Avatar for GTech4life

The filename of the .java file should be the same as the name of the public class it contains. You need to add a println that shows what number is being tested as well as the results of the test.

Member Avatar for TrustyTony
0
282
Member Avatar for kelvin.njuguna

If you are getting errors, You forgot to post the full text of the error messages.

Member Avatar for Johannady2
0
98
Member Avatar for Fotis_13

There are two steps in using an array of objects. The first one defines the array. Your code does that. The second step is assigning an instance of an object to each element of the array. Your code does NOT do that. For example: call[0] = client; // assign an …

Member Avatar for Fotis_13
0
412

The End.