Смарт контракты

Published 15 October 2018

JAVA Developer User Experience

JAVA Developer User Experience

This page describes the minimum required user skill for working with the Credits Software

A smart contract is developed using the interpreted JAVA language, which makes it possible to develop and conduct testing on absolutely any platform without having to install a special development environment. The program code allows the use of all common script language constructs (including cycles).

Let's analyze the definitions and necessary supported language constructs of the JAVA language. As an example, let's take the smart contract Java class:

Classes. The constructor class. Inheritance.

Classes. The constructor class. Inheritance.

The Class defines the structure of the object and its methods that form the functional interface.

Inheritance is the process of a class adopting properties (methods and fields) of another class.

A smart contract on the Credits platform is the JAVA class inherited from the SmartContract class.

A constructor is a special method that happens when a new object is created. It is not always convenient to initialize all the class variables when creating its instance. Sometimes it's easier for some values to be created by default when creating an object. The constructor is needed for automatic initialization of variables. It is also possible to initialize variables when they are declared.

The constructor initializes the object directly at time of creation. The name of the constructor is the same as the name of the class, including the case, and the syntax is similar to a method without a return value.

Functions

Functions

A method is a function that is part of a class that can perform operations on data of this class. In the Java language, the entire program consists of only classes and functions that can only be described within them. That's why all functions in the Java language are methods.

Areas of visibility

The following access modifiers exist in the Java language:

  • private: class members are available only within the class;
  • protected: class members are available inside the package and in the inheritors;
  • public: class members are available to all;

Sequence of modifiers in descending order of closeness: private, protected, public).

The function can take parameters and also return them.

Branching and cycles. Comparison Operators.

Branching and cycles. Comparison Operators.

Branching (conditional instruction) is a programming language construct that provides execution of a certain command or a set of instructions only if a certain logical expression is true or execution of one of several commands (sets of commands) depending on the value of some expression.

Cycle is a kind of control structure, designed to organize a multiple times execution of a set of instructions.

The branching and individual cycles are based on logical comparison operators, which determine the need to execute the following lines of code or go to others.

Most comparison operators apply to numeric values. All these are binary operators that have two numeric arguments, but return a Boolean value.

  • > the "more" operator
  • >= the “more or equal” operator
  • < the “less” operator
  • <= the less or equal» operator
  • != the «not equal» operator
  • ==  the equivalence operator
Votes 1, average rating 1

Contents