From 00cb2c8d35a3aa48b832db26ef844916245e3f2f Mon Sep 17 00:00:00 2001
From: "nshizirungudieumerci@gmail.com"
+ It is worth pointing out that Java has some very handy naming conventions. It is advisable to both use meaningful names and to follow these naming conventions while developing software in Java for good maintenance and readability of code.
+
+
+ Class names should be nouns that are written in UpperCamelCase, namely with the first letter of each word capitalized including the first.
+ For example,
+ Method names use lowerCamelCase which start with a verb that describes the action they perform. This means that method names start with a lower case letter, and use upper case for each internal-word method names. For example,
+ Instance variables of a class start with a lower case letter and use lowerCamelCase like method names. For example,
+ Constants are in all upper case letters or in upper snake case, which also known as screaming snake case, and which is a naming convention in which each word is written in uppercase letters, separated by underscores.
+ For example,
+
+
+ Which of the following is a valid variable name according to the core syntax rules of Java, but causes a syntax error in Python? +
++ Incorrect. Leading underscores are valid in both Java and Python (commonly used in Python for private/protected attributes). +
++ Incorrect. Snake_case names with underscores are valid in both languages (and are actually standard convention in Python). +
+
+ Correct! Java allows the dollar sign (
+ Incorrect. Numbers at the end of variable names are valid syntax in both Java and Python. +
+- It is worth pointing out that Java has some very handy naming conventions. It is advisable to both use meaningful names and to follow these naming conventions while developing software in Java for good maintenance and readability of code. -
- --
- Class names should be nouns that are written in UpperCamelCase, namely with the first letter of each word capitalized including the first.
- For example,
- Method names use lowerCamelCase which start with a verb that describes the action they perform. This means that method names start with a lower case letter, and use upper case for each internal-word method names. For example,
- Instance variables of a class start with a lower case letter and use lowerCamelCase like method names. For example,
- Constants are in all upper case letters or in upper snake case, which also known as screaming snake case, and which is a naming convention in which each word is written in uppercase letters, separated by underscores.
- For example,
- Which of the following is a valid variable name according to the core syntax rules of Java, but causes a syntax error in Python? -
-- Incorrect. Leading underscores are valid in both Java and Python (commonly used in Python for private/protected attributes). -
-- Incorrect. Snake_case names with underscores are valid in both languages (and are actually standard convention in Python). -
-
- Correct! Java allows the dollar sign (
- Incorrect. Numbers at the end of variable names are valid syntax in both Java and Python. -
-