Prepare
Practice
Interview
Aptitude
Reasoning
English
GD
Placement papers
HR
Current affairs
Engineering
MCA
MBA
Online test
Login
Online Practice Test
>
Java
« Previous
Next »
Which of the following is considered as a blue print that defines the variables and methods common to all of its objects of a specific kind?
Options
- Object
- Class
- Method
- Real data types
CORRECT ANSWER : Class
Discussion Board
e
d
dick 10-24-2022 10:09 PM
Classes
Classes in Java is a blue print from which individual objects are created. For example:
public class Dog{
String breed;
int age;
String color;
void barking(){
}
void hungry(){
}
void sleeping(){
}
}
The class consists of the following variable types:
1. Local variables: Variables defined inside methods, constructors or blocks are called local variables. It will be declared and initialized within the method and it will be destroyed when the method has completed.
2. Instance variables: are variables within a class but outside any method. These variables are instantiated when the class is loaded. Instance variables can be accessed from inside any method, constructor or blocks of that particular class.
3. Class variables: are variables declared with in a class, outside any method, with the static keyword.
A class can have any number of methods to access the value of various kinds of methods.
Rohit Sharma 07-29-2014 03:44 AM
« Previous
Next »
Write your comments
*
*
Email must be in the form someone@domain.com
*
*
Enter the code shown above:
Please enter the code shown above
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)
Related Content
Java Beginner (11)
Java (39)
Java (40)
Java (22)
Java (30)
Java (25)
Java (20)
Java (20)
Core Java (20)
Core Java (10)
Core Java (72)
EJB (20)
JDBC (20)
Applet (20)
Struts (21)
Servlets (20)
Java Web Services (20)
Javascript (40)
J2EE (10)
jQuery (46)
Advertisement
▲