Creating a class in java using Netbeans IDE | OOP | Object Oriented Programming | Constructors

Publicado el: 21 junio 2026
en el canal de: AmirBukhari
24
1

#class
#oop
#java
#netbeans


00:00 Start
00:07 OOP
01:01 class
01:18 object & class
03:30 attributes/characteristics/properties/field
04:49 Methods
05:50 Class Diagrams / Notations
07:33 creating a project in NetBeans
09:32 creating a class
11:55 getter / setters
17:39 constructor / default
21:40 parametrized constructor

/////////////////////////////////CODE//////////////////////////////////////////////
package classdemo2;

public class ClassDemo2
{
public static void main(String[] args)
{
Calculate c1 = new Calculate();
c1.setn1(45);
c1.setn2(55);

double r =c1.getResult();
System.out.println("Result = " + r);
System.out.println("Result = " + c1.getResult());

System.out.println("//////////////////////////////////");

Calculate c2 = new Calculate();
System.out.println("Result = " + c2.getResult());

System.out.println("//////////////////////////////////");

Calculate c3 = new Calculate(3,9);
System.out.println("Result = " + c3.getResult());

}
}

class Calculate
{
private double number1;
private double number2;
private double result;

public Calculate()
{
number1 = number2 = 0;
}
public Calculate(double n1, double n2)
{
number1 = n1;
number2 = n2;
}

public void setn1(double n1)
{
number1 = n1;
}
public void setn2(double n2)
{
number2 = n2;
}
public double getResult()
{
result = number1 + number2;
return result;
}

}
/////////////////////////////////CODE//////////////////////////////////////////////



Welcome to my YouTube channel, where you'll find videos on a variety of topics, from tech to nature to everything in between.

Whether you're looking to learn how to use Articulate, SolidWorks, or Microsoft Office, or you're interested in seeing the beauty of Jubail City, birds, flowers, fishes, or light shows, I've got you covered.

I'm passionate about sharing my knowledge and experiences with others, and I hope my videos help you learn something new, be inspired, or simply enjoy a few minutes of relaxation.

So what are you waiting for? Subscribe to my channel today and start exploring!

Comment below and let me know what topics you'd like to see more of.
Hit the subscribe button and turn on notifications so you never miss a new video.
Share my channel with your friends and family so they can enjoy it too.
I look forward to seeing you around!


En esta página del sitio puede ver el video en línea Creating a class in java using Netbeans IDE | OOP | Object Oriented Programming | Constructors de Duración hora minuto segunda en buena calidad , que subió el usuario AmirBukhari 21 junio 2026, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 24 veces y le gustó 1 a los espectadores. Disfruta viendo!