0
Best code style for Java
1-A if(true){ //do somethings } B if(true) { //do something } 2-A switch(var){ case 1: //do somethings break; } B switch(var){ case 1 : //do something break; } and how can make my code style better ??.
2 Antworten
+ 3
Any style is the best. There is no hard and fast rule.
Try which suits you.For me,I do what I want, its a mixture.
To make your code style better,
I recommend using indents for higher level things.
Also use comments to recognise a part of your code and to assist you.
Here's how I feel is the most comfortable way to read(it's similar to python style)
class A{
int z;
A(){
Do something
}
class B
and so on...
Its just using indents correctly.
+ 1
google 'coding conventions' with whatever language you're looking for, its always important to pick up good habits early and while they are always "recommendations" not requirements, i would always say follow them as much as possible to make your code easy to read