loading...

Java Structure

vrnsky profile image Yegor Voronyansky ・2 min read

Java is programming language with static typization. Which means that programmer need declare type and name of the variables. After it made we may use it.


int wheels = 4

By this string we say to the compiler that we need integer variable with name wheels.
Let's talk about data types at the java. As we know exist next type:

byte

This type is 8 byte signed integer. It may uses for optimize speed by using it the huge array. Min value is -128 and max value is 127

short

This type is 16 byte signed integer. Also uses for optimize speed with using huge array. Min value is -256 and max value 255.

int

By the standard this is 32 byte integer. Min value 2-32 and max value is 232 - 1. By default all variable declared with this type set default value 0.

long

This is 64 byte integer. At the Java 8 support unsigned value, by this way we may have max value 2(64) - 1

float

This primitive needs for represent value with floating point(single precision). It is 32 byte value. Do not use this type for operation with currency values.

double

Double precision, it is 64 byte value. Do not use for operation with currency values.

char

This primitive we need to represent an unicode symbol. Min value is \u0000 and max value is \uffff.

boolean

This primitive needs to represent only two value - true or false. We need to mark some expression.

Strings

In additional to above, exist a class which represent a string at the java. If you put some string literal at the double quoute and assign it to the some string variable we get string variable with provided given literal.

You are write
String author = "vrnsky";

But inside it call
String author = new String("vrnsky");

Also notice that class marked as a final class. Which say to us that each instance of this class is immutable. And it is good.

Posted on Jan 10 '19 by:

Discussion

markdown guide