4,084 Posted Topics

Member Avatar for sk8ergirl

if your final is tomorrow, you should have understood this by now. all your questions are very, VERY, basic knowledge. I have no doubt you can find the answers to all of them in your cours notes. if you are taking a course which takes more than 1 hour a …

Member Avatar for hfx642
0
123
Member Avatar for tleverington1

[Code=Java] for (int x = 0; x < StArray.length; x++) { Name = JOptionPane.showInputDialog("Enter First and Last Name:"); StudentID = JOptionPane.showInputDialog("Enter StudentID"); Address = JOptionPane.showInputDialog("Enter Adress"); Student[] Object = new Student[x]; StArray[x] = Object[x]; System.out.println(Object[x]); } [/Code] you have some logical mistakes here: 1. you shouldn't use 'Object' as the …

Member Avatar for tleverington1
0
2K
Member Avatar for nasimalotaibi

can you provide us with the full error messages? either you 've not given us all of your code, or you're also having trouble with the lines [Code=Java] list List1 = new list(); ... IntSLLNode t; [/Code]

Member Avatar for stultuske
0
345
Member Avatar for oldezwe

what do you mean by 'between numbers'? on the same line? on a separate line? what is your input, what is your output and what exactly is the output you expect?

Member Avatar for stultuske
0
233
Member Avatar for ethio

what you're doing wrong? you're trying to cast a JButton to a JPasswordField [Quote="Error message"]Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.JButton cannot be cast to javax.swing.JPasswordField[/Quote] I assume what you are trying to do is, validate the info in your JPasswordField? in that case: you'll need to have a JPasswordField (let's …

Member Avatar for stultuske
0
832
Member Avatar for bmichelle510

well ... what you are describing is not the output of running the code you've posted. in the code you've posted, when you start your application, you'll see the text "the doctor is in" when you press any button, you clear that text without setting a new value visible.

Member Avatar for bmichelle510
0
233
Member Avatar for baz_thug005

NO effort from your side, NO help from ours. you say you didn't copy the code of your prof, well ... as far as we know, you didn't get any code, and are supposed to write it yourself. if it is code your prof handed you to help you, no …

Member Avatar for Ezzaral
-4
83
Member Avatar for stevemag

and as for the white spaces: remove all the spaces (off course after you've made copies of the original values, if you still need them later on)

Member Avatar for stultuske
0
316
Member Avatar for popsyjohnson

what class is data an instance of? I assume it is the Scanner class? remember, you're Scanner is trying to read a boolean, while you're having your user enter an integer. (don't really use Scanner myself, but this might be the issue.) try with: [Code=Java] boolean mail_List = false; if …

Member Avatar for hfx642
0
122
Member Avatar for oldezwe

let's start here: [Code=Java] int[] mainArray = {}; [/Code] you say that mainArray is an array without elements, and later on, you try to store information in the array for indexes it doesn't have. an option would be: [Code=Java] int[] mainArray; int y = getNumberOfElementsForArray(); mainArray = new int[y]; [/Code] …

Member Avatar for Ezzaral
0
236
Member Avatar for sk8ergirl

I assume this is because in your for loops, you always start with 0. try by starting them with 1

Member Avatar for NormR1
0
707
Member Avatar for gourav1

if your exam is about to arrive, I doubt this is the first time you've had the option to study this material. realise that an int is (normally portrayed as) decimal, that what you want is hexadecimal, take a look at the differences and see if you can find the …

Member Avatar for JamesCherrill
0
311
Member Avatar for divsok

[QUOTE=Samith Dilhara;1711496]Suppose the xMethod() is invoked in the following constructor in a class, xMethod() is _________ in the class. public MyClass() { xMethod(); } A. a static method B. an instance method C. a static method or an instance method what is the answer a or b or c[/QUOTE] the …

Member Avatar for stultuske
0
1K
Member Avatar for javabeg123

or, don't save the length, since you're not really using it: save the name with the greatest length so far when you enter a new name: [Code=Java] //... counter++; if ( input.length() > storedName.length()) storedName = input; //... [/Code]

Member Avatar for stultuske
0
232
Member Avatar for gahhon
Member Avatar for BleepyE

the code worked fine but: [Code=Java] while(!word.equalsIgnoreCase(termination)); [/Code] he should just have removed the ';' there.

Member Avatar for BleepyE
0
117
Member Avatar for tqmd1

this is a Java forum, not a JavaScript forum (no, they are not the same) and to answer your question: yes, there is, and even if I'm mistaken and it's not a standard validation, it's not that hard to write.

Member Avatar for JamesCherrill
0
141
Member Avatar for ajwhite4
Member Avatar for ali11

NormR1 is repeating "Main class" for a reason. You don't want a Main class. You don't need a Main class. As he already told you, you need to implement a main method (and yes, there is a big difference). no matter what course you are taking, or what book you …

Member Avatar for jwenting
0
199
Member Avatar for gourav1

what questions? every question you have is answered in the book Cleo123 referred to. SCJP (or OCPJP) is about the basics of Java language, it goes deeper into basic stuff that can happen every day. it gives you better insight into what happens when you compile, run , ... your …

Member Avatar for stultuske
0
161
Member Avatar for rotten69

> try this...this syntax might not be the answers that your expecting.... public class qwe { public static void main(String []args) { int array []= {1,2,4}; for( int x = 0; x < array.length; x++) { System.out.println(array[x]); } } } > end quote. This was exactly the issue, NewbieGuy, but …

Member Avatar for stultuske
0
155
Member Avatar for Blahthing

re-check every { and } for instance: why do you open a bracket on the next line [Code] if(!world.multiplayerWorld) { world.entityJoinedWorld(new EntityRocketLAW(world, entityplayer)); ++timesshot; [B]{[/B] itemstack.damageItem(6, entityplayer); return itemstack; [/Code] I think you'll find you didn't close all your blocks that you open with a '{'.

Member Avatar for hiddepolen
0
135
Member Avatar for anand01

depends on what you want and what you need. there are lots of frameworks out there, but what do you want them to do for you: handle your front-end, back-end, ...

Member Avatar for anand01
0
119
Member Avatar for beshoo

also: re-think your expressions and tests for your while loop. just think about it, how many times will your [Code=Java] while(true){ //... } [/Code] run?

Member Avatar for stultuske
0
2K
Member Avatar for dsoto

try adding File temp = new File("filename.txt"); System.out.println(temp.getAbsolutePath()); if you create a FileInputStream, your vm will automatically assume the file already exists, while when using a File object, you can first verify and create one if necessary.

Member Avatar for stultuske
0
278
Member Avatar for umair jameel

you are calling the method getInt() from the class EasyIn. unless you have written a class EasyIn, that class does (as far as I know) not exist. if you did make it, you need to import it. or, you could use the [URL="http://docs.oracle.com/javase/6/docs/api/java/util/Scanner.html"]Scanner[/URL] class instead.

Member Avatar for NormR1
0
842
Member Avatar for asif49

ever tried asking the almighty [URL="http://www.lmgtfy.com/?q=UML+%2B+inheritance"]Google[/URL]? how do you think it is represented?

Member Avatar for JamesCherrill
0
97
Member Avatar for asif49

to add an object to (for instance) ArrayList<YourType> list = new ArrayList<YourType>(); the object you want to add has to pass the "is-a-YourType" it's not that difficult to do that, but the compiler will not allow any that don't pass this test to be added, so reading up on Generics …

Member Avatar for stultuske
0
97
Member Avatar for hemanthjava

a 'little' old? you do have a talent for understatement, don't you? not only old, also bit ... sneaky. as far as I can tell, by looking at the previous posts, what he wanted to do, was "borrow" (propably his choice of words) or "steal" (the legal definition) contents of …

Member Avatar for stultuske
0
161
Member Avatar for Sweetblac2000

so, we must assume he did not give 'X' as input. even worse, we can assume that the code he is showing us is not the code he was running when he got the exception. he get's an exception thrown for a line of code somewhere in his instance methods …

Member Avatar for JamesCherrill
0
95
Member Avatar for ali11

you mean: can we re-write it for you in OO-design? sure we can, but we won't. what you've done so far, is copy pasting your assignment here, and hoping we will do your work for you. step 1: decide on which objects you'll need step 2: implement the methods you …

Member Avatar for peter_budo
-2
137
Member Avatar for asif49

while(true) will always be true, so it will never leave the loop, unless you add a break statement, or change expression you are testing on

Member Avatar for gusano79
0
6K
Member Avatar for dineshswamy

well, it's telling you on which line you are using a variable that you haven't instantiated yet. add a print right before it, so you can check which var it is, or add default values to your variables, that should help you out.

Member Avatar for JamesCherrill
0
252
Member Avatar for newprogrammer01

add the weight of each person to weights, and verify if the capacity of the elevator can take the extra weight before going over it's maximum.

Member Avatar for stultuske
0
249
Member Avatar for jonnyboy12

ehm ... you don't need to put an entire class somewhere to be able to use it. you can always instantiate it and use the instance, just like you do it now in your main method in that class

Member Avatar for stultuske
0
112
Member Avatar for sirlink99

what error is thrown? what is the complete code? you're not giving us a lot to work with

Member Avatar for JamesCherrill
0
713
Member Avatar for hadeelh30

1. implement all the methods of ActionListener you should implement 2. what belongs in one class, put it in one class 3. don't use a 'course' variable without declaring one if you just try and compile, your compiler will give you a list of errors it encounters, that can also …

Member Avatar for NormR1
0
139
Member Avatar for justmelloyellow
Member Avatar for lgbagabuyo

what do you mean 'put them together' and which mistakes are you referring to? is the code not doing what you expect it to do?

Member Avatar for lgbagabuyo
-1
2K
Member Avatar for hadeelh30

by writing the code. all I see is your assignment, what are you having trouble with exactly?

Member Avatar for hiddepolen
-1
69
Member Avatar for harinath_2007

[URL="http://docs.oracle.com/javase/6/docs/api/java/lang/UnsatisfiedLinkError.html"]explanation[/URL] possible solution: add a try-catch block

Member Avatar for stultuske
0
324
Member Avatar for BDan

ehmmm.... no. just [Code=Java] combobox1.getSelectedItem(); [/Code] getItemSelected() is not (as far as I know, anyway) an existing method and you can not let a method be followed immediately by a new String like you do in your last post.

Member Avatar for BDan
0
431
Member Avatar for programing

you start with a string the charAt method will return the char on the index you provide in the string you apply it to. IgnoreCase() => this can occur in equalsIgnoreCase(), a method that you can find in the String class. just run the next piece of code, and you'll …

Member Avatar for stultuske
0
190
Member Avatar for Boobah

seriously.. this is not Developers-for-Rent as you said yourself, it's a simple question, so I have no doubt you'll be able to solve it yourself, or, at least, produce a bit more code than you've shown us so far.

Member Avatar for stultuske
-1
137
Member Avatar for ecyarter

@cbrolly21 ... serious.. the last post here was in april 2005 ... not to mention the facts that a. what you suggested here, has already been suggested before b. the OP already said his problem was solved so ... how exactly does this post contribute to the thread?

Member Avatar for hfx642
0
6K
Member Avatar for chriswinter

well ... no offence, but you've made a mess out of your usage of {'s and }'s. starting from line 108. not to mention the fact that you're using variables you didn't declare or initialize. you may want to spend some minutes cleaning your code.

Member Avatar for chriswinter
0
196
Member Avatar for NeoSyn

and remember: [Code=Java] if (bet == "high") { rollTotal = total; } else if (bet == "low") { } else if (bet == "seven") { } [/Code] is a big NO-NO. never compare objects with the == comparator, always use the .equals method.

Member Avatar for NeoSyn
0
281
Member Avatar for yoshio5908

what is it doing wrong? as far as I see from your code, what you're doing wrong is that you don't compare max and adding to number times occurences within your loop.

Member Avatar for zeroliken
0
609
Member Avatar for dsoto

WHY do you think it is wrong? WHY are you unsure about those methods? what do you expect as output?

Member Avatar for dsoto
0
173
Member Avatar for krejar

[Code=Java] if (minScore > scores[i]); [/Code] remove the ; an if (just like a lot of other 'blocks') can be given a scope in two ways: either you put the code between { /*enter code here */} OR the 'block' ends at the first ;

Member Avatar for krejar
0
771

The End.