0

Object and class

describe it

19th Feb 2017, 12:33 PM
Xerox
Xerox - avatar
4 ответов
+ 2
A class is anything that can hold a particular kind of objects. Example , Insect is a class while cockroach is an object.
19th Feb 2017, 12:48 PM
Meharban Singh
Meharban Singh - avatar
0
any code
19th Feb 2017, 1:01 PM
Xerox
Xerox - avatar
0
Here you go, public class insect{ //Creating a class public String Bite(int x){ //Creating a method do somestuff; } } Now lets say I want to add an insect and use its Bite method. then in my main method, public class program{ //another class public void main(String[] args){ //main method //Now I will create an object of INSECT first namely cockroach so that i can use Bite method insect cockroach=new insect(); cockroach.bite(); } } Hope it helps
23rd Feb 2017, 9:47 AM
Meharban Singh
Meharban Singh - avatar
0
I know its difficult to understand at first, but you will get it as you proceed. Never give up and Best of luck, my Friend.
24th Feb 2017, 5:47 AM
Meharban Singh
Meharban Singh - avatar