You are on page 1of 3

Java program – collection of objects care comunica intre ele prin metode; - object oriented

Constructors – the same name as a class

Singleton Classes – create only one instance of a class

Object – caracteristici (color, name) + comportament (eating); instanta unei clase;

Class – template care descrie comportamentul si caracteristicile obietelor sale; O clasa poate contine
mai multe metode;

Methods – un comportament; where all the actions are executed; cu litera mica; object-to-object
communication

Instance Variables – fiecare obiect are un set unic de variabile instant; caracteristica unui obiect este
creata de valoril asignate acestor avriabile instant;

Public class MyFirstProgram{

Public static void main (String [args]) {

System.out.println (“Tina”);

Main() method – mandatory!!

Program file name = should match the class name

Identifiers – names used for classes, variables, methods; - begin with a letter, character or
underscore

Java Variables

 Local – defined inside methods, constructors

 Class (Static) –static keyword

 Instance(Non-static) – inside a class, outside the method

Array – multiple variables of the same type

Enum –restrict a variable to have one of only a few predefined values

Mostenire – interfata

Interfata – defineste metode, subclase

Regular expressions:

Pattern class – a pattern object is a compiled representation of a regular exprecion –


compile()

Data structures: enumeration, vector, dictionary. Hashtable, properties, BitSet

BitSet – a group of bits that can be set and cleared individually


Hashtable-sort

Ce stii despre JAVA? -> limbaj de programare ce ruleaza pe multe platforme: Win, Mac, UNIX –
Solaris, RedHat Linux, Ubuntu, CenOS

Features of JAVA -> Object Oriented, Platform Independent, Robust, Interpreted, Multi-threaded

High – Performance -> Java uses Just-In-Time compiler to enable high performance.

Java IDE’s – NetBeans, Eclipse

Java keywords – import, super, finally

Object – entity ; its behavior is shown via methods; methods – object-to-object communication;

Creating an Object: first is declared, instantiat si dupa initializat;

Class – in interiorul ei sunt create obiecte; clasa poate contine fields and methods to describe the
behavior of an object;

Variables in class: Local, instance and class variables;

 Local V: V definitie in interiorul metodei, constructorilor sau blocurilor. Aceste


variabile vor fi declarate si initializate in interiorul metodei si vor fi distruse atunci
cand metoda e complete;

 Instance V: in interiorul clasei dain in afara metodei; sunt initializate cand clasa e
incarcata;

 Class V = static V: instance V + static keyword

 Var used in a switch statement: string,enum,byte,short,int,char

 Singleton class: control object creation, limiting the number to one but allowing the
flexibility to create more objects if the situation changes.

 Constructor: fiecare clasa are un constructor; constructorul este invocate atunci cand
un nou obiect este creat; daca nu scriem un constructor pentru o clasa, compilatorul
java construieste un constructor default pt ea

Default value for byte datatype=0; - used to save space in large arrays; mai mic decat int

float = 0.0f; double=0.0d

package used for pattern matching with regular expressions: java.util.regex

Finalize() method – used to ensure than an object terminates cleanly; is called just before an
objects’s final destruction

Final class -the methods implemented cannot be overridden


Exception -problems that arises during the execution of a program;

Runtime Exceptions – sunt ignorate la compilare;

Exception – IOException and RuntimeException Clasa

Abstract Class- nu pot fi instantiate si sunt partial sau deloc implementate. Aceasta clasa

contine mai multe metode abstracte - care sunt doar declarii de metoda, fara body;

Encapsulation – private fields in a class and providing access to the fields via public methods.
Benefit: the ability to modify our implemented code without breaking the code of others use
our code;

Interface – colectie de metode abstracte

 Nu poate fi instantiate

 Nu contine consructori

Package – group of classes, interfaces providing access protection

Multithreaded program – contains two or more parts that can run concurrently. Each part of such a
program is called a thread, and each thread defines a separate path of execution;

Thread can be created by: implementing Runnable interface, extending Thread class

Thread – execution in a program

Applet – Java program that runs in a Web browser – java.applet.Applet class

Garbage collection – to free the memory

Set Interface - collection of element which cannot contain duplicate elements;

TreeSet – Set implemented when we want elements in a sorted order;

Overloading Method – if a class has multiple functions by same name but different para,etters

Overriding Method – subclass provides a specific implementation of a method that is already


provided by its parent class

NullPointerException – when calling the instance method of a null object;

Wrapper classes – allow primitive types to be accessed as objects: Integer, Character, Dourble,
Boolean;

Constructors must have the same name as the class and cannot return a value. They are only called
once;

Primitive types – byte, char, short, int, long, float, double and Boolean

Socket – communication between 2 computers using tCP. Java.net.ServerSocket

You might also like