23
ΜΕΤΑΒΛΗΤΕΣ-ΣΤΑΘΕΡΕΣ - ΕΚΦΡΑΣΕΙΣ ΕΡΓΑΣΤΗΡΙΟ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΗΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΣ (Διαφάνειες: ΧΟΧΟΛΗΣ ΔΙΟΝΥΣΙΟΣ Προσαρμογή 2014: Κώστας

1 Variables Datatypes Operators

Embed Size (px)

DESCRIPTION

a java helper!provides theory and examples of variables datatypes operators

Citation preview

  • - - (: 2014: )

  • () ()

  • . java . bytes . (byte,char, short,int,long float, double,boolean) (, ) int A[100]; String str;

  • int , , float, double , , AT String boolean float[] grades Node { .. }

  • char int , short, longfloatdoublebyte boolean

  • (short, int, long) : byte (8 bit) -128 +127 short (16 bit) -32.768 +32.767 int (32 bit) -231 +231-1 ( -2 +2 ) long (64 bit) -263 +263-1 2

  • int x;int x, y, z;double r;byte b;int x = 1;int x, y = 0, z = 2;double r = 1.87;long abc = 42000000;

  • char (single quotes) 'C', '2', '*', ',' -: char char choice= 'A'; char x, y; 2 byte (65.535 )

    unicode.

  • float double

  • float ( ) ( ) .., 0.012 ( ) .. 6.3-05 4 bytes (32 bit) -: float float x;

  • double ( ) float. 8 bytes (64 bit) -: double double x;

  • boolean boolean true false ( ) -: blean boolean b;

  • java ;int count;int count, num; =;int count = 20;float num = 0.2;

  • (operators) (operands) : ( ) :num + 12num1 > num2(a+b)/c

  • : : ++, , +(unary), (unary), *, /, %, +, : =, +=, =, *=, /=, %= : =, ==, != : !, &&, || . bits : ,>>>, &, ^ : () : ?: : ,

  • + ( String ) * / ( )++ 1 1%Modulo ( )= += = *= /= %=

  • < ; ;>= ;== ;!= ;! & AND&& AND ( 2 1 false)| OR|| OR ( 2 1 true)

  • int x = 10; int y = 20; x y ++x; 11 20 y = --x; 10 10 y += x--; 9 20 y -= x++ ; 10 11

  • ( )(5*x+y/4)*8 ( )x==3 a!=b (x+y) >= 4 ( )(x=1) (x==0) || (y==0)

  • print println System.out int num=1;System.out.println(H num + num);

  • 1 java FahrenheitToCelsius float . , , . : C = (5/9) * (F - 32)

  • 2 java CalculateCircleData r float . r. p 3.14. .