Welcome to the Kodlama Vakti Channel!
Article: https://kodlamavakti.com/java/yazim-v...
As the Kodlama Vakti team, our goal is to remind our followers that programming can be learned by everyone. The tutorials on our channel are carefully prepared and completely free! It's Coding Time!
If you find our tutorials helpful and like them, don't forget to like the video and subscribe to our channel.
Hello dear Kodlama Vakti followers, in this lesson, we'll learn the rules we need to keep in mind when coding in Java, namely Java Syntax and Naming Conventions. Why are these rules so important? Because, like every language, Java has its own set of conventions. Some of these conventions are specific to Java, while others are general conventions we must follow when writing code. For example, when naming code, we follow conventions like "Camel Case" and "Snake Case." There are many other syntax conventions. Before we start coding, we continue to grasp the basics. Writing Rules and Recommendations:
What should we pay attention to when writing code?
Using Turkish Characters
Case Sensitivity
Class Names
Method Names
No Forbidden Words
Using Turkish Characters
In Java and many programming languages, we should avoid using Turkish characters, and if possible, avoid using them altogether. Because Turkish characters belong to different character sets, they will often return errors in our code.
Turkish Characters: ç, ı, ü, ğ, ö, ş, İ, Ğ, Ü, Ö, Ş, Ç
Case Sensitivity
Java is a case-sensitive language. In Java, "Kodlamavakti" and "Kodlamavakti" have different meanings. Therefore, when naming a class, attention should be paid to uppercase and lowercase letters.
Class Names
In Java, the first letter of a class name must be capitalized. If we combine two words to form a class name, the first letter of the name must be capitalized. For example; KodlamaVakti
Method Names
Method names begin with a lowercase letter. If two words are to be combined when naming a method, the first letter of the name is written in lowercase, and the first letter of the other words being combined is written in uppercase. Example: kodlamaVakti
Java Forbidden Words
Keywords (Forbidden Words) Cannot Be Used
abstract assert boolean break byte
case catch char class const
continue default do double else
enum extends final finally float
for goto if implements import
instance of int interface long native
new package private protected public
return short static strictfp super
switch synchronized this throw throws
transient try void volatile while
What is Camel Case?
Camel case is a naming convention where the first letter of each word in a compound word, except the first word, is written in capital letters. Software developers often use "Camel Case" when writing source code. While Camel Case is not mandatory, it is the jargon of the programming language, and all developers generally follow this convention. This rule makes variable names more readable.
Example: codingTime, camelCaseRule, javaDesertsBegins
What is Upper Camel Case?
The Upper Camel Case naming rule is that the first letter of all words in a compound word is capitalized.
Screaming Snake Case
All letters are written in capital letters. It is often used in constant naming.
Snake Case
Words are joined with an underscore (_).
Upper snake case example: Hello_World
Lower snake case example: hello_world
Naming Conventions in Java
Upper camel case is used for classes. HelloWorld
Lower camel case is used for methods. helloWorld
Lower camel case is used for variables. helloWorld
Screaming snake case is used for constants. HELLO_WORLD
In this lesson, we learned the naming and spelling rules in Java. If you liked our lessons, please share them with your loved ones using the share buttons!
On this page of the site you can watch the video online Java Lessons #4 - Java Syntax and Naming Rules with a duration of hours minute second in good quality, which was uploaded by the user Kodlama Vakti 19 April 2020, share the link with friends and acquaintances, this video has already been watched 121,617 times on youtube and it was liked by 1.2 thousand viewers. Enjoy your viewing!