Method of Creating Class and Object
How to create class and object?
Answers
Answered by
0
class-import java.io.*;
import java.util.*;
class Program
{
object-scanner obj=new Scanner (System.in);
{
import java.util.*;
class Program
{
object-scanner obj=new Scanner (System.in);
{
Answered by
0
//creating a class
keyword tagname
{ private:----------;
public:----------;};
//creating class object
tagname object;
example...
class A
{ private:
int a,b;
char name[20];
float m;
public:
void input();
void process();
void output();
};
A n;
here 'n' is the class object and 'A' is the class name.... and those functions in public tag are member functions...
keyword tagname
{ private:----------;
public:----------;};
//creating class object
tagname object;
example...
class A
{ private:
int a,b;
char name[20];
float m;
public:
void input();
void process();
void output();
};
A n;
here 'n' is the class object and 'A' is the class name.... and those functions in public tag are member functions...
Similar questions