Hello world, I'm talking about creating a class in Java using eclipse. I have nothing open right now. The first thing I'm going to do is save file new project and a Java project and next . Let's call this shape1. There's a button next down here, and hit finish. The next thing I need to do is select file, new, class. I'm going to name this one shapes. This is the one that's going to have static void main. And browse shapes1, source and finish. The next thing going to do is say file, new, class. I want to name this class Rectangle. I do NOT want to create public static void main for this one, so we'll hit finish, And here's my public class rectangle. and my class is going to have a length and width, but I want to make sure that link and with our always positive values. The way to protect them is to make them private. so type private double width=1; (Fix the spelling) and also private double length= 1; Then I'm going to pick source, Generate Getters and Setters. I want both the length and the width to have those. There's an okay button down here the bottom you can't see. and then we click okay. You can see that it generated getWidth which will return the width, and setWidth which receives a width as an argument. and the argument width is assigned to the width that is a field within the class. But I don't want to just accept any value, I'm going to say if(width>0) this.width= width; and then we have to getLenth and setLength and I'm going to do the same thing: if(length>0) then I will assign that value to this.length. The next thing I'm going to do is to go to source, Generate toString. I'm just going to say okay for this. and will take a look at that to strangle you notice it says override and it returns... This is NOT what I want to return! I want just a null string, plus the width plus an "x", plus the length. so if it's a 3 x 5 rectangle it will return 3X5. We also will need constructors and a constructor is where we can use it to say a new rectangle. So it is always public. public Rectangle() with no values, no arguments, or parameters. This will just keep the width and the length the way they are. I would also like another one where I could receive double width and double length. and I'm going to say inside this one, if(width>0) this.width=width; and also if (length>0) this.length=length; (fixing typos); Just take a look at that again, and that looks okay so now going to go back to my main, and I'm going to declare an instance of that Rectangle: Rectangle myRect= new Rectangle with no arguments. and then I'm going to also make a rectangle myRect2= new Rectangle(3,5); Let's print them out. We can say system.out.println(myRect); and it will convert that toSting (if I can manage to spell it right), here, okay. And let's just run that right now. and you'll see this one, myRect says new rectangle. That's using this those default values that I put in, and the constructor with no arguments. The second one, where we assign values of 3 and 5, Let's print that one out, And myRect2 and we can run that. I forgot the parenthesis, okay. Let's try again. So the first one is 1x1 and myRect2 is 3x5 and you can look at that code, and see that I had 2 constructors and the first constructor just left the default values the way they were. And the second constructor accepts values if they are greater than zero. Let's go back here and let's try making one of these zero. and then just run it. and you'll see the first one is the default 1 by 1, and the second one 3 x 0 changed that to three by one, because it did not accept zero. It's important to note that I don't exit, or do any weird stuff back here. If it's not accepted, it's just not accepted, so that value never got assigned. It's really up to the programmer that's using this class to make sure they didn't have an error in the program, and that everything was accepted.