Java Tutorial For Beginners 18 – Classes and Objects in Java

Searches related to Classes and Objects in java
classes and objects in java pdf
classes and objects in java ppt
classes and objects in c++
classes in java
classes and objects in java with realtime examples
methods in java
encapsulation in java
define class in java


Anand Gupta says:

you have told that using getter and setter u can secure your data ,but u don’t have told how it is doing that. Please focus on logics also


hi all while writing code after giving dot after mark in the pop up box id name are not coming .can anyone help me to resolve this issue. I am new to java.Thanks

Venkat Mohith says:

sir,if we havent use getters and setters in the student class..they cant be used in my class?

Vario nabilz says:

thx man! it really helps me to understand class and object in java. keep it up the good work!

svinay05 says:

Sir, U have shown the use of getter and setter methods. My query is can we get input from user for id, name and age using scanner object in one class and call the methods in second class which has main method. Thanks in advance.

nalinee srivastava says:

sir please provide tutorial for struts and hibernate

nalinee srivastava says:

sir please provide tutorial for struts and hibernate

Žan R says:

For those of you who can’t grasp the concept of objects and classes. I was in the same situation as you. I watched a ton of videos and I just didn’t quite get it. So after hours of researching about objects and classes I finally decided that I would actually write the code that these Youtubers were writing in their tutorials. I did some examples after these kind of tutorials and I basically practiced what they were doing. I also googled some exercises for this topic and after a couple of hours everything started making sense. The point is don’t just watch these tutorial videos. You should try writing the code by yourself and do exercises on the specific topic that way you can really start thinking and overtime you will start understanding what they were talking about. Trust me.

Akbar Umar says:

Thank You so much, so easy to understand, now i know what are classes and objects LOL 😀

uxzh says:

In Netbeans 8 i am getting an error with my strings “Colour is erroneous” for example. Can someone help

Jummah Khan says:

Good Java learning tutorial.

Marcus L says:

After all these years, I finally understood why do we need to use the keyword this. Thank you very much!

Aakash Bhargava says:

Please Sir,
Suggest me correct code for this program .I faced execution error in this code

package Calculation;

import java.util.Scanner;

public class Calculator {

static char choice;
static int a1, b2 , ad, sb, ml, dv,pr;

public static void main(String[] args) {

System.out.println(“Enter first number”);

Scanner num1 = new Scanner(;
a1 = num1.nextInt();
System.out.println(“Enter sevond number”);
Scanner num2 = new Scanner(;
b2 = num2.nextInt();

System.out.println(“Enter + for addition”);
System.out.println(“Enter – for subtraction”);
System.out.println(“Enter * for multiply”);
System.out.println(“Enter ÷ for division”);
System.out.println(“Enter # for clear screen”);
System.out.println(“Enter % for percentage”);

System.out.println(“Enter calculation choice”);
Scanner scan = new Scanner(;
choice =;


case ‘+’: addition ad1 = new addition();

ad = ad1.Add(a1 , b2 );
System.out.println(“addition is” +ad);

case ‘-‘:subtraction sb2 = new subtraction();
sb = sb2.Sub(a1 , b2);
System.out.println(“Subtraction is”+sb);

case ‘*’: multiplication mul3 = new multiplication();
ml = mul3.Mul(a1, b2);
System.out.println(“Multiplition is” +ml);

case ‘÷’: division dv4 = new division();
dv = dv4.Div(a1,b2);
System.out.println(“Division is” +dv);

case ‘%’: percentage pr5 = new percentage();
pr= pr5.Per(a1, b2);
System.out.println(“percentage is” +pr);



Jalaj Gupta says:

why do we use the word “NEW” and what is use of that


You’re stunning!

abhishek mahtta says:

how does getter and setters protect from data corruption please explain? a programmer can change id, age,name in both the cases u have shown

Think Hatke says:

how i can create class inside main class using notepad …….

Gulshan Kumar says:

pls tell me is there any method used in java to clear the screen as used clrscr() in c or c++.??

Narala Archana says:

Very easy to understand tqq u so much sir

Rajat Kumar says:

I am facing a problem……. When i am trying to import any variable from a class it show me a error like id is a variable so it is showing “id cannot be resolved or is not a field.”……… Hep me Thanks

jose munguia says:


Nic Maoury says:

Why not make the field variables private?

Tushar Jajodia says:

Bro it is you can give not you can gave.
I think you need a grammar tutorial

Devarasetty SAI KRISHNA VAMSHI says:

I understood the 1st part but the 2nd part of getid( )…
Please explain it clearly

Everman says:

you have like 3 smoke alarms peeping. good video but those annoying beeping kills it. unprofessional!

hiren vaishnav says:

I imprested….hello! dear, I’m a developer, and I lead a team who develop an android app for movement and digital India,

Champ Charizard 777 says:

Easy!!! Thanks.

Black Crusader says:

WTF? Stop this bullshit! Mark is not an object, it’s only a reference variable that link to an object. Who are you? Maybe Mr. Helloworld… or Mr.Newbie

Savolla Ross says:

use “CTRL+2 , R” for changing all “selected” variables at once

Zerobrine says:

2 fps lol


Sir I am getting error by – student canot be resolved to a type, please help me.

Saptangshu Manna says:

You could have used private variables after using getters and setters

sai kumar dora says:

simply and superb….

C Causey says:

Can someone explain which part is missed with protecting your data. Which ones should have been private?

tambsaps says:

Watch at 1.5X speed for beginners, 2X speed for programmers coming from another language

Allison Scanlan says:

My ears are burning off :(

RevinCSGO says:

Hmm mm mm. N mmnyyy

vasant dhond says:

what is instance of class?

Hardik Banugaria says:

dont we have to have Private instances on other class then its worth to setters and getters there.

Write a comment


Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles▷ Show Cars▷ Motorbikes▷ Scooters▷ Bicycles▷ Rims & Tires▷ Luxury BoatsFashion▷ Sunglasses▷ Luxury Watches▷ Luxury Purses▷ Jeans Wear▷ High Heels▷ Kinis Swimwear▷ Perfumes▷ Jewellery▷ Cosmetics▷ Shaving Helpers▷ Fashion HatsFooding▷ Chef Club▷ Fooding Helpers▷ Coktails & LiquorsSports▷ Sport Shoes▷ Fitness & Detox▷ Golf Gear▷ Racquets▷ Hiking & Trek Gear▷ Diving Equipment▷ Ski Gear▷ Snowboards▷ Surf Boards▷ Rollers & SkatesEntertainment▷ DIY Guides▷ Zik Instruments▷ Published Books▷ Music Albums▷ Cine Movies▷ Trading Helpers▷ Make Money▷ Fishing Equipment▷ Paintball Supplies▷ Trading Card Games▷ Telescopes▷ Knives▷ VapesHigh Tech▷ Flat Screens▷ Tech Devices▷ Camera Lenses▷ Audio HiFi▷ Printers▷ USB Devices▷ PC Hardware▷ Network Gear▷ Cloud Servers▷ Software Helpers▷ Programmer Helpers▷ Mobile Apps▷ Hearing AidsHome▷ Home Furniture▷ Home Appliances▷ Tools Workshop▷ Beddings▷ Floor Layings▷ Barbecues▷ Aquarium Gear▷ Safe Boxes▷ Office Supplies▷ Security Locks▷ Cleaning ProductsKids▷ Baby Strollers▷ Child Car Seats▷ Remote ControlledTravel▷ Luggages & Bags▷ Airlines Seats▷ Hotel Rooms▷ Fun Trips▷ Cruise Ships▷ Mexico Tours