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

7. Selenium Tutorial - II. Java for Selenium - 5. Java Basic Syntax

https://www.gcreddy.com/2021/05/java-basic-syntax.html
Java Syntax – Java for Selenium

Basic components of Java Programming:

A Java program is a collection of objects, and these objects communicate through method calls to each other to work together.

1. Class: The class is a blueprint(plan) of class objects and status.

Example: The blueprint of the house is class.

2. Object: The object is an instance of a class, has Behavior and state.

Example: A Car is an object

States of the Car object: brand, color, height, etc,

The behavior of the Car object: Running on the road.

3. Method: The behavior of an object is the method.

4. Instance Variables: Every object has its own unique set of instance variables. The state of an object is generally created by the values that are assigned to these instance variables.

Basic Syntax Rules:

1. Case Sensitivity

Java is a case-sensitive language, there is a difference between upper case and lower case letters.

Examples:

Suppose Java Class Name – ‘MyClass’ is different from’ myclass’.

Java variable name – ‘NUM’ is different from ‘num’.

Note: Java keywords/Reserved words are small letters, and we can use upper case or lower case letters for Java identifiers. If we use upper or lower case letters for any identifier then use the same letters for the entire program.

2. Comments in Java

Inserting comments in Java programs is optional but best practice, it is not a syntax rule, coding standard.

We write comments in computer programs to increase the readability of programs and preventing some parts of the code from execution.

Java supports three types of comments:

a. Single-line Comments

Syntax:

// It is a single line comment

b. Multi-line Comments

Syntax-

/*Comment starts
continues
continues
.
.
.
Comment ends*/

c. Documentation Comments

This kind of Java comment is utilized by large code for a programming bundle since it produces a documentation page for reference.

/**Comment start
*
*tags are used in order to specify a parameter
*or method or heading
*HTML tags can also be used
*such as h1
*
*comment ends*/

3. Java Program File Name

The name of a Java program file should exactly match the Java class name with an extension of .java.

4. Java Class Names

a. The first letter of the class should be in Uppercase

b. If several words are used to form a name of the class, each inner word’s first letter should be in Upper Case, Underscore are allowed.

Example:
class Sample // valid syntax
class MyJavaProgram // valid syntax

class sample // invalid syntax
class myJavaProgram // invalid syntax

5. main() Method

Java program processing starts with the method main(), which is mandatory for every Java program.

6. Java Method Names

All the Java method names should start with a Lower Case letter.

7. Java Identifiers

a. All identifiers can begin with a letter (A to Z or a to z) or an underscore _.

b. The first character of identifiers can have any combination of characters.

c. Most importantly identifiers are case-sensitive.

d. A keyword cannot be used as an identifier since it is a reserved word and has some special meaning.

Note: Class names, Variable names, and Method names, etc are the Identifiers in Java.

8. Java Keywords

Keywords or Reserved words are the words in a language that are used for some internal process or represent some predefined actions. These words are therefore not allowed to use as identifiers.

Example:

Modifiers are keywords: public, private, protected, static, final, synchronized,

Primitive Data types are keywords: byte, short, int, long, float, double, char, boolean,

Control flow statements are keywords: if, else, switch, for, while, do, break, continue, return,

Others:
package, import, this, super, throw, try, catch, void, etc,

9. White-spaces and Blanks lines in Java

A line containing only white spaces is known as a blank line, and the Java compiler totally ignores it.

10. Java Modifiers

These modifiers control the scope of classes, methods, and variables.

11. Java Statements and Code blocks

Every Java statement or step should end with a semicolon, and Java code blocks are enclosed with curly braces {}.

12. Explicit Declarations of Variables

Java supports the explicit declaration of variables, which means we need to declare first before using them.

Example:

int x;
x=100; //valid syntax
y=200; //invalid syntax

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

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

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

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