Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ru.fciit.pdfgeneretor.networking.nettyapi;
- public class ConstructorTest {
- int i;
- String z;
- boolean daunLiTi
- /**
- * конструктор с параметром (параметризированный конструктор)
- * на выходе получается объект в котором уже i = переданному
- *
- * @param i аннотация ломбока: @AllArgsConstructor
- */
- public ConstructorTest(int i) {
- this.i = i;
- }
- public ConstructorTest(int i, String z, boolean dolboeb) {
- this.i = i;
- this.z = z;
- this.daunLiTi = dolboeb;
- }
- private void test() {
- //get instance of parametrized constructor
- ConstructorTest test = new ConstructorTest(123);
- //get instance of non-parametrized constructor;
- ConstructorTest test2 = new ConstructorTest();
- //get instance of multiparameter constructor
- ConstructorTest dolboeb = new ConstructorTest(228, "ti dolboeb?", true);
- }
- /**
- * конструктор без параметров
- * на выходе получается объект в котором i = 0
- * аннотация ломбока @NoArgsConstructor
- */
- public ConstructorTest() {
- i = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement