+ 2
When to use brackets?
I recently decided to try out Java after getting fairly good at python, and all of the curly brackets, parentheses, and semi colons are making me want to explode. It makes sense when I look at Java code, but when I go to do it myself it just looks like a mess. Does anybody have any tips on these sort of things?
2 Answers
+ 2
I'm new to both python and java, but maybe this will help create a foundation:
brackets enclose classes, methods, if statements, loops
parentheses enclose method arguments
semicolons mark the end of statements in classes and methods
there's certainly more information to be known, but that's what I know so far. I hope it's at least a start.
+ 3
lol. i felt crazy when i started to learn python that doesnât have curly brackets {} and semicolons ;;;; javascript, c, c++, java, c# all have curly brackets to structure the code. the tip is in the place where in python you indent the code you need to put the curly bracket in java, hope it helps