Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- public class ConstructorTest {
- int i;
- /**
- * конструктор с параметром (параметризированный конструктор)
- * на выходе получается объект в котором уже i = переданному
- * @param i
- * аннотация ломбока: @AllArgsConstructor
- */
- public ConstructorTest(int i) {
- this.i = i;
- }
- /**
- * конструктор без параметров
- * на выходе получается объект в котором i = 0
- * аннотация ломбока @NoArgsConstructor
- */
- public ConstructorTest() {
- i = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement