Paul Clapham wrote:
What is that line of code intended to do?
David Henstridge wrote:
Paul Clapham wrote:
What is that line of code intended to do?
I don't know about that specific line...
Paul Clapham wrote:
David Henstridge wrote:
Paul Clapham wrote:
What is that line of code intended to do?
I don't know about that specific line...
But you got it from your instructor? Then you'd better go back and ask your instructor what you did wrong. Typing text which you don't understand and then asking people on the internet to help you fix it isn't a good strategy for learning Java, I'm sorry to say. It's just as bad to type working text which you don't understand, although it may seem better because it works. It really isn't better though.
David Henstridge wrote:I have no interest in becoming proficient in Java.
Much too late for that at my age.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
David Henstridge wrote:I now know what a Frame, Panel, Button, main class, public, private class are.
The basics. That's enough for me. :)
Paul Clapham wrote:
David Henstridge wrote:I now know what a Frame, Panel, Button, main class, public, private class are.
The basics. That's enough for me. :)
Those aren't the basics, though. Frame, Panel, and Button are very specialized classes. One thing I would classify among "basics" of the Java language is the assignment statement. But apparently you don't recognize an assignment statement, because you miscopied several of them and then couldn't recognize the problem.
So yes, I agree, you could get by if you only knew the basics. To learn the basics I would recommend The Java™ Tutorials -- you'll find a section entitled "Trails Covering the Basics". You could probably get away with just the first half of the list of tutorial trails in that section.
Paul Clapham wrote:Since we're talking about "basics", one of the basics you should learn is how to copy text from one place and paste it to another place. It beats the stuffing out of retyping things.
David Henstridge wrote:What text are you referring to specifically?
All code that I used I copied and pasted here.
Paul Clapham wrote:
David Henstridge wrote:What text are you referring to specifically?
All code that I used I copied and pasted here.
But you posted
whereas the lesson you linked to had this:
And when I copy and paste it I get this:
I suppose you just assumed your copy-and-paste had worked correctly (as any normal person would) but then when you started having problems you didn't go back and compare your code to the original.
David Henstridge wrote:
I'm glad you are trying to help me Paul.
You still are making assumptions though.
...
It still comes down to this. The code that I posted at the top worked for this instructor, as
she was entering it no Red errors popped up on the left side at any point.
As I was entering the code red errors kept popping up for me (using her code).
I made no mistakes entering the code. It was character for character exactly the same as hers.
Paul Clapham wrote:Well, I have to make assumptions, don't I? You don't tell us anything. And when you do, you tell us misleading things. That's just the nature of trying to explain things over the internet, or trying to explain things in general.
Zachary Griggs wrote:
This is not valid code. Right now, you're naming "num1" and then creating a float with parseFloat, but the compiler has no idea what to do with this. I assume you wanted to store the created float in num1, but if so you'll need to tell the compiler that you want to do that, using the assignment operator (=).
But you should stay far away from GUIs until you have a good java foundation.
Carey Brown wrote:Notice the difference between
and
what do you want to happen with the returned value from parseFloat()?
Paul Clapham wrote:Well, I have to make assumptions, don't I? You don't tell us anything. And when you do, you tell us misleading things. That's just the nature of trying to explain things over the internet, or trying to explain things in general.
So I'll try not to. For example you said you copied text from a Youtube tutorial precisely, character for character. I'm not going to assume that you are correct in saying that. In fact it's quite likely that you aren't. What you posted wasn't valid Java code and your IDE correctly told you so. So if your Youtube instructor didn't have that problem, the conclusion to be drawn is that you typed different characters than the instructor, or you did something different while modifying the code.
At any rate when you modified the code, for some reason you removed the equals signs and changed perfectly normal assignment statements into code with errors.
Campbell Ritchie wrote:Why should we look at that video? You have been told several times that isn't valid Java® code, so please believe us.
As I said earlier, don't use floats.
David Henstridge wrote:
He concluded I typed different characters than what the instructor did. This video has smoking gun evidence that shows what characters the instructor typed.
All things are lawful, but not all things are profitable.
Knute Snortum wrote:The smoking gun is, that in fact, the instructor typed in valid code.
Henry Wong wrote:
I agree with Campbell here. The code isn't valid, so the whole side thread was a waste of time. If you had acceptable that earlier, you could have moved on to the solution earlier.
This "smoking gun" evidence doesn't change that. At best, all it does is rationalize (or justify, not sure yet), you ignoring this fact, and hence, assign blame to someone. So, meh, arguably, this follow up side thread is also irrelevant.
Henry
David Henstridge wrote:Rather than telling me the code was not valid as several have done in this thread, it would have been far more productive and informative for me, had they said:
"Oh sure I can help you. You can fix the code by putting an equals sign between here, and here and here. Problem solved!"
Paul Clapham wrote:
David Henstridge wrote:Rather than telling me the code was not valid as several have done in this thread, it would have been far more productive and informative for me, had they said:
"Oh sure I can help you. You can fix the code by putting an equals sign between here, and here and here. Problem solved!"
Yeah, we could do that. But what's going to happen is, every time you get an error you will be here asking somebody else to fix it for you. And then after a year of this you will have your project completed and you will congratulate yourself, even though none of it was your work. If you're happy to do that, then carry on doing what you're doing now. For me, I would prefer for the result to be my work. Asking for advice, I don't have a problem doing that when starting out in a field where I don't know much, but I do prefer that I learn something and produce something out of that learning.
Anyway I've suggested in the past that the preferred way to go is for you to learn basic Java before you try working with the rather advanced code you have there. I reiterate that suggestion -- I believe I posted a link to a useful tutorial. It isn't a video tutorial, perhaps your learning style is more video-oriented than text-oriented but on the other hand it's a lot easier to copy code from a text-based tutorial.
David Henstridge wrote:A Java application just happened to come my way. We will be using it shortly on a regular basis.
It does its job, but the interface leaves much to be desired.
I know it is possible to tinker with Java code and so I thought I would seek help in making some very minor adjustments.
Paul Clapham wrote:
Frankly, if that's the case I think it would be much more practical to just ask somebody else with Java experience to do that for you. That way the changes are going to get done in a finite time and the end product is going to be reliable.
David Henstridge wrote:
Knute, I'm curious to know the minute mark of the video where you took that snapshot?
Here's a snapshot from the video, taken at the 5.55 min mark.
Henry Wong wrote:
David Henstridge wrote:
Knute, I'm curious to know the minute mark of the video where you took that snapshot?
Here's a snapshot from the video, taken at the 5.55 min mark.
Here's a snapshot from the video, also taken at the 5.55 min mark. And it looks fine to me.
Henry
PS... I still think that this side discussion is silly, but since the main discussion has been completed, why not? ...
David Henstridge wrote:I can't think of any explanation for the differences we are seeing in the video.
In the screenshot I posted you can see that there is not even the faintest hint of equals signs in the area we are focusing on.
Please tell me of some possible reasons why the video I watched (and downloaded) and the one you watched are different?
I am beginning to think there is some kind of conspiracy going on here.
Liutauras Vilda wrote:
Shall I mark this topic as "resolved" for you?
We're trying to keep threads content beneficial for future readers without adding unecessary noise which are not related directly to the problem you were trying to solve.
David Henstridge wrote:If the changes were important/critical/many I would go that route.
But they are small and not very important really.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
David Henstridge wrote:
I can't think of any explanation for the differences we are seeing in the video.
In the screenshot I posted you can see that there is not even the faintest hint of equals signs in the area we are focusing on.
Please tell me of some possible reasons why the video I watched (and downloaded) and the one you watched are different?
I am beginning to think there is some kind of conspiracy going on here.
Dave Tolls wrote:I'm going to go with video resolution.
Either different resolutions of the video itself, or in the display of it.
Depending on how the compression does its thing (at either end) it's possible to lose narrow vertical and/or horizontal lines.
Did someone say my new 4K resolution monitor is not good enough and shows incredibly pixelated picturesHenry Wong wrote:Agreed, it is definitely related to resolution... You can see it in the screenshots. Besides the equal signs being missing, the screenshot is incredibly pixelated.