By using this site, you agree to our Privacy Policy and our Terms of Use. Close

Forums - General - Does anyone here know java?

nordlead said:
I'm not sure why you are getting your exception though. You should get a line number for the exception and look around there. 30 minutes isn't enough time to fix this unless you really know what you are doing.

The exception comes from him using commas in the if statement.  And I only used the if statements to show him how to quickly change his code and try not to confuse him or give him a solution that his professor would see as too advanced for his current stage.

Obviously in java I could do this setNumber method with one for loop and one case switch.  No need to make an array of chars when you can just use the loop to call the .charAt method.  Saves a step and keeps it all in Strings except for the Case Switch.



Around the Network
nightsurge said:
nordlead said:
I'm not sure why you are getting your exception though. You should get a line number for the exception and look around there. 30 minutes isn't enough time to fix this unless you really know what you are doing.

The exception comes from him using commas in the if statement.  And I only used the if statements to show him how to quickly change his code and try not to confuse him or give him a solution that his professor would see as too advanced for his current stage.

Obviously in java I could do this setNumber method with one for loop and one case switch.  No need to make an array of chars when you can just use the loop to call the .charAt method.  Saves a step and keeps it all in Strings except for the Case Switch.

lol, obviously my java skills aren't up to snuff. I also didn't notice he only had 30 minutes until after I posted

edit: I wouldn't say it is too advanced either. We did stuff like that in our intro to programming course.




If you drop a PS3 right on top of a Wii, it would definitely defeat it. Not so sure about the Xbox360. - mancandy
In the past we played games. In the future we watch games. - Forest-Spirit
11/03/09 Desposit: Mod Bribery (RolStoppable)  vg$ 500.00
06/03/09 Purchase: Moderator Privilege  vg$ -50,000.00

Nordlead Jr. Photo/Video Gallery!!! (Video Added 4/19/10)

nordlead said:
nightsurge said:
nordlead said:
I'm not sure why you are getting your exception though. You should get a line number for the exception and look around there. 30 minutes isn't enough time to fix this unless you really know what you are doing.

The exception comes from him using commas in the if statement.  And I only used the if statements to show him how to quickly change his code and try not to confuse him or give him a solution that his professor would see as too advanced for his current stage.

Obviously in java I could do this setNumber method with one for loop and one case switch.  No need to make an array of chars when you can just use the loop to call the .charAt method.  Saves a step and keeps it all in Strings except for the Case Switch.

lol, obviously my java skills aren't up to snuff. I also didn't notice he only had 30 minutes until after I posted

Hehehe   Yeah, I hope he got my posts before too late.

By the way, I'm taking a C and Unix intro course next semester.  I always wondered what the difference in C/C+/C# or whatever actually was.  Do you have any take on this?  I am not even sure if this C course is just C or if it is C#, C+, etc.



nightsurge said:
nordlead said:

lol, obviously my java skills aren't up to snuff. I also didn't notice he only had 30 minutes until after I posted

Hehehe   Yeah, I hope he got my posts before too late.

By the way, I'm taking a C and Unix intro course next semester.  I always wondered what the difference in C/C+/C# or whatever actually was.  Do you have any take on this?  I am not even sure if this C course is just C or if it is C#, C+, etc.

Here is a very very high level difference between the languages.

C is a programming language that is not Object Oriented. It is typically used for low level programming. Almost identical syntax to C++.

C++ is an extension of C only with Object Oriented programming in mind. C++ is considered a midle level language as it has high level and low level capabilities. C++ has been extended to a lot of uses from COM to Windows Forms. The fact that it is Object Oriented is the biggest differentiator between it and C.

C# is an extension of C++ which to a lot of people seems to be a cross between C++ and Java (it isn't really). C# is typically used for quick and easy Windows programming, but can be used for some lower level applications. It also works on the .NET framework so (in theory) can be run on any platform. It generally has worse performance than C/C++, but unless you are pressed for performance typically performs well enough. You can also easily use C++ libraries to speed up sections of code.

There are a lot more differences but that is the basic gist of it. You can read more at wikipedia. Once you start to understand the languages you can get a better feel for when to use which language.

However, as a final note, please never mix C and C++. They are different and one of the worst programming mistakes people make is freely mixing the two, both at the file level (.c and .cpp files in a single project) and the code level (implementing C++ style for loops in .c files). Both of those cause major compile issues if you ever have to port code or use a different compiler. I once spent weeks sorting out another companies code trying to port it from Solaris to Linux and Windows.




If you drop a PS3 right on top of a Wii, it would definitely defeat it. Not so sure about the Xbox360. - mancandy
In the past we played games. In the future we watch games. - Forest-Spirit
11/03/09 Desposit: Mod Bribery (RolStoppable)  vg$ 500.00
06/03/09 Purchase: Moderator Privilege  vg$ -50,000.00

Nordlead Jr. Photo/Video Gallery!!! (Video Added 4/19/10)

So once I get a hang of C, I should look into C++ (without getting C into my C++ code ) and then C# (C-sharp? just wanting to make sure that's what this is)?

As for overall usage, do you think I'd be better off being an expert in Java, C#, or both? Answer three ways: If I can only pick one, if I can pick them both, if I can pick both but there are other languages that would pair better with Java than C# or pair better with C# than Java.



Around the Network
nightsurge said:
So once I get a hang of C, I should look into C++ (without getting C into my C++ code ) and then C# (C-sharp? just wanting to make sure that's what this is)?

As for overall usage, do you think I'd be better off being an expert in Java, C#, or both? Answer three ways: If I can only pick one, if I can pick them both, if I can pick both but there are other languages that would pair better with Java than C# or pair better with C# than Java.

Moving from C to C++ to C# (yes, C-Sharp) is generally a good idea in terms of learning how to program. However, there is nothing stopping you from jumping straight into C++ or even C#.

As for use in business, it really depends on where you work. I learned C# in college and my work extensively uses C#. However, some companies/businesses use Java or even VB.NET. If you know where (or what field) you want to work, then I'd suggest talking to someone and seeing what they use.

Personally, I would chose C# over Java as it is so much easier to use with C/C++ and having to interact with other components. If you are in a very computer science type field, then Java is fairly popular. If you want to get into AI, then LISP would be a good language to learn. However, none of that really matters so long as you really learn good programming techniques like Object Oriented design. The techniques are the key, as syntax is easily learned and generally similar between languages.




If you drop a PS3 right on top of a Wii, it would definitely defeat it. Not so sure about the Xbox360. - mancandy
In the past we played games. In the future we watch games. - Forest-Spirit
11/03/09 Desposit: Mod Bribery (RolStoppable)  vg$ 500.00
06/03/09 Purchase: Moderator Privilege  vg$ -50,000.00

Nordlead Jr. Photo/Video Gallery!!! (Video Added 4/19/10)

Thank you guys but I got it taken care of, I really appreciate the help :P (though that was a bit beyond where we are in the class lol)



MaxwellGT2000 - "Does the amount of times you beat it count towards how hardcore you are?"

Wii Friend Code - 5882 9717 7391 0918 (PM me if you add me), PSN - MaxwellGT2000, XBL - BlkKniteCecil, MaxwellGT2000

I have worked professionally as a C# and Java developer and I have worked with C++ (and heavily used C++ in school) ... The differences between these languages are (pretty much) irrelevant, and the underlying principles that lead to good design are what is really important.

 



HappySqurriel said:

I have worked professionally as a C# and Java developer and I have worked with C++ (and heavily used C++ in school) ... The differences between these languages are (pretty much) irrelevant, and the underlying principles that lead to good design are what is really important.

 

Good you can answer a very big question of mine.  Something that's been annoying me for ages now.

In the professional setting, how big of a deal was commenting, and how thoroughly did you have to do it?  It seems like each new CS professor I have, they introduce a different guide for commenting, and they all place differing levels of importance on it.  One class didn't require much at all.  One class wanted comments every single line.  The current class I'm in wants us to use JavaDoc and that seems like the most commenting and way more than necessary....



nightsurge said:
HappySqurriel said:

I have worked professionally as a C# and Java developer and I have worked with C++ (and heavily used C++ in school) ... The differences between these languages are (pretty much) irrelevant, and the underlying principles that lead to good design are what is really important.

 

Good you can answer a very big question of mine.  Something that's been annoying me for ages now.

In the professional setting, how big of a deal was commenting, and how thoroughly did you have to do it?  It seems like each new CS professor I have, they introduce a different guide for commenting, and they all place differing levels of importance on it.  One class didn't require much at all.  One class wanted comments every single line.  The current class I'm in wants us to use JavaDoc and that seems like the most commenting and way more than necessary....

Depends on the language, how you write your code and company requirements. Personally, I would say get in the habbit of writing a lot of comments as it makes it easier in the long run.

If it is Assembly, then 1 comment every line is incredibly helpful as it is a pain to decrypt what someone else wrote. If you use abriviations, again comments are incredibly useful and should be plentiful. If you never use abriviations (my favorite way of writing code) then comments before every logical section makes sense. So maybe comments before a section that setup and execute an FFT on a data set, then another comment before sending the results to a display.

At a minimum you should have comments for the function description, inputs, and outputs for every function, and comments for what the variables are meant to be used for.




If you drop a PS3 right on top of a Wii, it would definitely defeat it. Not so sure about the Xbox360. - mancandy
In the past we played games. In the future we watch games. - Forest-Spirit
11/03/09 Desposit: Mod Bribery (RolStoppable)  vg$ 500.00
06/03/09 Purchase: Moderator Privilege  vg$ -50,000.00

Nordlead Jr. Photo/Video Gallery!!! (Video Added 4/19/10)