318 Posted Topics

Member Avatar for xshinichix

[CODE] public class Class1{ } public class Class2 extends Class1{ //class 2 is a subclass of class1 } [/CODE] That is the basic syntax for inheritance in java.

Member Avatar for jon.kiparsky
0
191
Member Avatar for kodera
Member Avatar for sateal8

You are declaring the same variable from your processScore() method params in all your enhanced loops. You cannot do that. The enhanced for loop needs to have a type and variable declared locally. You read the loop as: (for each double in list) //do something It is not the same …

Member Avatar for Akill10
0
216
Member Avatar for Akill10

Hey, I have a question. I was writing a custom Array type class. In my template declaration I use the type name as DataType. I was making an attempt at creating an insert method, which takes a DataType argument and the index to insert at. I originally had this code: …

Member Avatar for Akill10
0
153
Member Avatar for patrickgormally

The reason the RHS of your decimal point is so large is because a double is a precise type. So you need to format the output. I suggest using the getCurrencyInstance() method of the NumberFormat class which will return a currency format, then pass the value into that format. [CODE] …

Member Avatar for Akill10
0
192
Member Avatar for kodera

I would love to see the source you are pulling this from. You [B]cannot[/B] create a method [B]inside[/B] another method. [CODE] public class add { public static void main(String[] args) { int sum = add(5, 2); System.out.println("Sum is " + sum); [COLOR="Red"]public static int add(int firstInt, int secondInt) { return …

Member Avatar for Akill10
0
76
Member Avatar for curbster

1. You have not created a constructor. 2. Why do you have a display method with the parameters your assignment spec said should be [I]inside [/I]the constructor? 3. Your spec says you need to create an array of objects, which in this case will be TVshow objects, not an array …

Member Avatar for Akill10
0
12K
Member Avatar for stephy1

As masijade said, look at your constructors. You cannot have multiple constructors [B]with the same parameters[/B], which in this case, is no parameters. And you also wrote your run method [B]inside[/B] the constructor. You [B]cannot[/B] write a method [B]inside[/B] another method.

Member Avatar for stephy1
0
385
Member Avatar for Davitch

In your printf expression, your format specifier is a float, try changing &f to &d. [url]http://sharkysoft.com/archive/printf/docs/javadocs/lava/clib/stdio/doc-files/specification.htm[/url]

Member Avatar for Davitch
0
89
Member Avatar for chipsch

But why would you want to do that? It takes away the point of object programming. You would just be setting a name to a variable, instead of the name of an employee, which doesn't really make much sense. edit: Say you create 2 employees [CODE]Employee jim = new Employee(...blah...); …

Member Avatar for Akill10
0
220
Member Avatar for anumash
Member Avatar for anumash
0
327
Member Avatar for kxpatel29

You must be getting an error. [CODE] while()(!(correctInputCheckChar == 'y' || correctInputCheckChar == 'Y'));[/CODE] Is not valid.

Member Avatar for Akill10
0
235
Member Avatar for david09436
Member Avatar for Red Goose
-3
151
Member Avatar for lashbandi
Member Avatar for jon.kiparsky
-2
132
Member Avatar for z00t

Think what you are trying to do. [CODE]Rectangle box = box.translate(40,30);[/CODE] the variable box is of type Rectangle. As javaAddict pointed out, the translate method returns void. This line is basically like saying: [CODE]int i = ;[/CODE] Therefore, void methods are called independently. Meaning, you do not need to store …

Member Avatar for Akill10
0
1K
Member Avatar for LegendX

There is no way to align System.out.print's. You will just have to use the \t,\n etc..to achieve your desired result. e.g. [CODE]System.out.print("Name\tAge\tAddress\n"); System.out.println("James\t20\tSandyHouse"); [/CODE]

Member Avatar for jon.kiparsky
0
172
Member Avatar for sateal8
Member Avatar for sateal8
0
196
Member Avatar for theurbanist

You would need a JFrame and a JComponent and some type of paint method. [url]http://java.sun.com/products/jfc/tsc/articles/painting/[/url]

Member Avatar for Akill10
0
114
Member Avatar for 09tikimo

Post your code using CODE tags. You also have not told us your problem. Do you have any parts working? Which part/parts are you having trouble with? Are there any compile errors?

Member Avatar for Akill10
0
219
Member Avatar for z00t

As naief pointed out, You have not specified the type of variable RectangleBox is. Every variable needs a type. [CODE] //type - variable name int a; double b; Rectangle rect;[/CODE] In your case, you want your RectangleBox variable to be of type Rectangle. Most naming conventions don't start variable names …

Member Avatar for ajst
0
160
Member Avatar for javanoob101

I don't think you fully understand objects. An object is an instance of a class. So, say you have a class named Monster, as stated above. You only ever have that 1 class, but you can create infinite number of objects(instances) of that class. [CODE]Monster mon1 = new Monster(); //mon1 …

Member Avatar for javanoob101
0
370
Member Avatar for Amoryethel

[B]B[/B] [I]Brackets first[/I] [B]O[/B] [I]Orders (ie Powers and Square Roots, etc.)[/I] [B]DM[/B] [I]Division and Multiplication (left-to-right)[/I] [B]AS[/B] [I]Addition and Subtraction (left-to-right)[/I] Split your calculations using this order of operations

Member Avatar for JamesCherrill
0
163
Member Avatar for almefab

Create a method in the class that uses JFrame that returns the value of x. [CODE]public int getX() { return x; }[/CODE] Then just called that method from your JPanel class.(I assume you know how to do that)

Member Avatar for almefab
0
990
Member Avatar for frank731tr
Member Avatar for AaronLLF

[QUOTE=AaronLLF;1450219]Nevermind... fixed it right after posting. Epic. Fail.[/QUOTE] Ok, but wouldn't it have been a better idea to keep your problem posted, and then post the solution you found? What if you were searching google for "basic 2d physics +java" and you saw this post advertised, would you not get …

Member Avatar for Akill10
0
182
Member Avatar for LianaN

add a Panel to the frame and draw the background on that. You shouldn't really be drawing directly onto the Frame anyway. But, if you want to, I would say you will need to use the getContentPane() method.

Member Avatar for LianaN
0
854
Member Avatar for bangor_boy

Add a println inside where you add to the arraylist, to make sure it is actually adding, print out the list also at this point.

Member Avatar for bangor_boy
0
126
Member Avatar for montalbano80

sLength, sWidth and sDepth are Strings. You cannot multiply strings. To convert a String that contains a number, to an int/double etc.. You must parse it. [CODE]int sWidth = Integer.parseInt(width.getText());[/CODE] Try that.

Member Avatar for Akill10
0
630
Member Avatar for javanoob101
Member Avatar for javanoob101
0
231
Member Avatar for NasserSJH

Why have you not implemented Runnable on any of the classes you are trying to run threads in? [CODE] public class TimerClass implements Runnable {[/CODE] [CODE]public class MouseGameV2 extends JFrame implements MouseMotionListener,Runnable { [/CODE]

Member Avatar for NasserSJH
0
205
Member Avatar for rusl07cl08

Why are you using recursion? It is not needed if you only print out 1 number. All you do is create your power method, then return Math.pow(x,n). You ask for a number, then ask for the exponent, there is no recursion needed. As was stated, you test the value of …

Member Avatar for Akill10
0
670
Member Avatar for coco24

So you want someone to do your homework for you? If you had read the [B]rules[/B] you would see that nobody will do your homework for you for less than $50

Member Avatar for JKP()
0
122
Member Avatar for Neversleepin

If you do not know which IDE to use, it means you are just starting off. If you are just starting off you shouldn't use an IDE(and even worse use it for GUI dev) If you did make said gui with an IDE, and you are a beginner, you will …

Member Avatar for peter_budo
0
467
Member Avatar for ovidiu_b13

[QUOTE=ovidiu_b13;1447110]I've started reading a fiew books and sites, to learn something. Can you give me an idea to start working on?[/QUOTE] Idea: You have a list, why not use that list to base your study off? Just google this list with +java in the search. 1. Classes - Objects 2. …

Member Avatar for JDCyrus
0
168
Member Avatar for triumphost

Please tell us the names and lines of the 2 textboxes and also the default value it places i.e. where you declare and initialise them. You can probably search it in your ide

Member Avatar for triumphost
0
252
Member Avatar for Progr4mmer

Instead of using inline code, create an if block using the {} braces. [CODE] if(prime % chk == 0) { prime++; chk++; } [/CODE] This is the extreme basics. Java,C#,C++ and many other languages(if not all) use code blocks.

Member Avatar for Akill10
0
144
Member Avatar for Smashed Badger

Like you I'm not too sure about the technical side, but I know for a fact this isn't the first time someone has thought of this idea. I remember playing Duke Nukem 3D..before MMOs were popular(or even that known) and I thought how good it would be to make a …

Member Avatar for ajst
0
145
Member Avatar for Anirudh.

[QUOTE=Anirudh.;1447406] PS:you are supposed to make use of scanner class[/QUOTE] Oh are we now? I'm glad you told me that, I was just about to write your program without it! Show your attempt.

Member Avatar for jon.kiparsky
0
104
Member Avatar for Neversleepin
Member Avatar for jsefraijeen

Ok, so you need a method that takes 2 double as paramaters, and returns a double. Then just calculate the hypotenuse using the formula you should have learned in primary school if you weren't one of those students who got other people to do their homework...oh wait. Post your attempt …

Member Avatar for bibiki
0
3K
Member Avatar for u_v
Member Avatar for kitt_simple

If you want to have a frame inside a frame: [url]http://download.oracle.com/javase/tutorial/uiswing/components/internalframe.html[/url] Otherwise: Is the frame being hidden under the other frame? Try offsetting the position of the frame on the screen.

Member Avatar for Akill10
0
94
Member Avatar for prem2

As bibiki pointed out, there is no scope resolution operator in java. If you are not in the wrong section, and you are actually talking about java, Then the reason you cannot call not-static methods/variables using [CODE]Object.variable1 ..etc[/CODE] Is because non-static variables/methods are Instance variables/methods. Meaning, they can only be …

Member Avatar for Akill10
0
152
Member Avatar for alonewolf23

You need to use + when concatenating parts of a String. [CODE]System.out.println("\n" + var1+"\n" + var2);[/CODE] You had a , instead of a +

Member Avatar for alonewolf23
0
19K
Member Avatar for tedelston

What is EasyIn? Is this your own class? It is not a java class. Normally, people use the Scanner class to take input. [CODE] Scanner input = new Scanner(System.in); n1 = input.nextInt();[/CODE]

Member Avatar for tedelston
0
280
Member Avatar for shiny27

You do not re-enter your judging loop, because judgecounter is never <= 5 again, After you increment your competitor counter, reset judgeCounter. [CODE]competitorCounter += 1; //increment competitor counter by 1 judgeCounter=1;[/CODE] Too fast for me gerard!:'( that damn indentation bled my eyes and I had to take a break!

Member Avatar for WaltP
0
103
Member Avatar for Mr_PoP
Member Avatar for justin3085

Or if you have a class that contains all your custom components and you want to add these to your current container. Make them all static, and then: [CODE] add(MyClass.button1) [/CODE]

Member Avatar for Akill10
0
105
Member Avatar for matrixcool

Have you imported java.util.Arrays? Which version of java are you compiling with?

Member Avatar for Akill10
0
128
Member Avatar for empror9

For your output error, I assume it's because you are calling cin.ignore() before you take input. afaik you should do this after input, to flush the input stream.

Member Avatar for empror9
0
112

The End.