-
-
Save uncoded-ro/274c76cb1bfabfb3fe33f0944b96b9e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Cerc { | |
static final double PI = 3.14; | |
static int count = 0; | |
int x; | |
int y; | |
int raza; | |
// metoda constructor 1 | |
Cerc() { | |
x = 0; | |
y = 0; | |
raza = 0; | |
} | |
// metoda constructor 2 | |
Cerc(int x0, int y0, int raza0) { | |
x = x0; | |
y = y0; | |
raza = raza0; | |
} | |
// metoda non-statica | |
public double aria() { | |
return PI * raza * raza; | |
} | |
// metoda statica | |
static int nrObiecte() { | |
return count; | |
} | |
public static void main(String[] args) { | |
Cerc c = new Cerc(2, 5, 4); | |
System.out.println(c.raza); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment