Reputation: 0 Apprentice
- Active Posts:
- 26 (0.04 per day)
- 16-September 12
- Profile Views:
- Last Active:
- Apr 27 2013 09:48 PM
- OS Preference:
- Favorite Browser:
- Favorite Processor:
- Favorite Gaming Platform:
- Your Car:
- Dream Kudos:
Posts I've Made
Posted 18 Apr 2013You're trying to call the method setByteToThisString() on a String variable, that you've named 'junk'. The compiler is telling you exactly what you need to know here - there is no method defined on Strings by that name. Perhaps you meant to call it on a different variable? I will admit I'm having difficulty seeing what this code is actually doing overall.
Thank you for the reply, and My apologies, I know the code is incomplete, but in short its an assignment for my java class. Our prof gave us his code for one program and told us to edit it to make it do the following: Use a grid layout to display the labels, jtextfields, and buttons, and make it so that when the button is pressed by a jtextfield it takes the number in it, adds it to the number in the next box, and display it there. Its an exercise with focus, grid layouts, and a little extra. I've got the first 2 parts down but am drawing a blank for the final part
Posted 26 Mar 2013My apologies to any one reading this. terrible mishap on my side and i have realized I left a few lines of code out.
Posted 18 Feb 2013I think you were meaning to do
demo.setBrandToThisBrand(new FoodV4("something", "something"));
You need to construct another object of FoodV4 and pass that into the method.
Ahh yes I see what I needed to do there. Basically just a formatting issue. Thanks for the reply though. It is much appreciated!demo.setBrandToThisBrand(FoodV4 anotherFoodItem);
when you call a method, you do not specify the parameter tyope so should be
assuming that anotherFoodItem is a FoodV4 object which is not the case, it is a String
but if you do
FoodV4 f4 = new FoodV4("xxx", "yyyyy");
it should work
Thank you for the detailed reply! I appreciate the insight!
Posted 12 Feb 2013I have a feeling that is happening because you are calling the function without providing a value to anotherFoodItem
Thanks for the reply, and where would I provide one? You can't put a string or a cast to FoodV4 in demo.setBrandToThisBrand(FoodV4 anotherFoodItem); without getting errors. I'm a bit confused by this.
Posted 11 Feb 2013Can you please post the exact errors that you are getting?
The output I get when running the test program is"
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
FoodV4 cannot be resolved to a variable
Syntax error on token "anotherFoodItem", delete this token
- Member Title:
- New D.I.C Head
- Age Unknown
- Birthday Unknown
DeadTheory23 hasn't added any friends yet.