RUVIDEO
Поделитесь видео 🙏

Java basics and syntax

📁 Лайфстайл 👁️ 16 📅 08.12.2023

Java is object oriented programming (OOP) language similar to C++. The syntax is the set of rules defining how a Java program is written and interpreted.
The syntax is mostly derived from C and C++.
Unlike C++, in Java there are no global functions or variables, but there are data members which are also regarded as global variables.
All code belongs to classes and all values are objects. The only exception is the primitive types, which are not represented by a class instance for performance reasons (though can be automatically converted to objects and vice versa via autoboxing).
Some features like operator overloading or unsigned integer types are omitted to simplify the language and to avoid possible programming mistakes.

These are Java basics and lets know about each one.

Identifier features:
Begin with any Unicode character that is a letter but cannot start with a digit
Subsequent characters may be letters, digits, dollar signs, or underscore characters
Currency sign (such as $) is permitted.
Special character such as _ is permitted.
It cannot be equal to a reserved keyword, null literal or Boolean literal.
White space is not permitted.
Choose self-explanatory names for variable for easier to read the code and understand. Using acronyms or abbreviations is discouraged.
Reserved keyword or word is not allowed.
User lowercase for single word and If it consists of more than one word, capitalize the first letter of each subsequent word. Example myScore.
All variables must first be declared before they can be used. This involves stating the variable's type and name:
int myScore = 10;

The separators { and } signify a code block and a new scope. Class members and the body of a method are examples of what can live inside these braces in various contexts.

Java has three kinds of comments:
traditional comments, end-of-line comments and documentation comments.
Traditional comments, also known as block comments, start with /* and end with */, they may span across multiple lines. This type of comment was derived from C and C++.
traditional comments,
/* Traditional comment: This is a multi-line comment.
It may occupy more than one line. */
- End-of-line comments start with // and extend to the end of the current line. This comment type is also present in C++ and in modern C.
end-of-line comments
// This is an end-of-line comment
- Documentation comments in the source files are processed by the Javadoc tool to generate documentation, these comments are a special kind of traditional comment and they are not specifically defined in the language specification.
documentation comments.
/**
* This is a documentation comment.
*
* @author
*/
 - Source files must be named after the public class they contain, appending the suffix .java
for example, HelloWorld.java.
- It must
first be compiled into bytecode, using a Java compiler, producing a file named HelloWorld.class
Java source file may only contain one public class, but it can contain multiple classes with other than public access and any number of public inner classes. When the source file contains multiple classes, make one class "public" and name the source file with that public class name.
- keyword public denotes that a method can be called from code in other classes, or that a class may be used by classes outside the class hierarchy. The class hierarchy is related to the name of the directory in which the .java file is located. This is called an access level modifier. Other access level modifiers include the keywords private and protected.
The keyword static in front of a method indicates a static method, which is associated only with the class and not with any specific instance of that class. Only static methods can be invoked without a reference to an object. Static methods cannot access any class members that are not also static. Methods that are not designated static are instance methods, and require a specific instance of a class to operate.
The keyword void indicates that the main method does not return any value to the caller. If a Java program is to exit with an error code, it must call System.exit() explicitly.
The method name "main" is not a keyword in the Java language. It is simply the name of the method the Java launcher calls to pass control to the program. Java classes that run in managed environments such as applets and Enterprise JavaBeans do not use or need a main() method. A Java program may contain multiple classes that have main methods, which means that the VM needs to be explicitly told which class to launch from.
The main method must accept an array of String objects. By convention, it is referenced as args although any other legal identifier name can be used

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Java basics and syntax», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.