Computer Applications
Name the following:
(a) What is an instance of the class called?
(b) The method which has same name as that of the class name.
Java Constructors
ICSE 2023
22 Likes
Answer
(a) Object.
(b) Constructor.
Answered By
16 Likes
Related Questions
Give the output of the following String class methods:
(a) "COMMENCEMENT".lastIndexOf('M')
(b) "devote".compareTo("DEVOTE")
Consider the given array and answer the questions given below:
int x[ ] = {4, 7, 9, 66, 72, 0, 16};
(a) What is the length of the array?
(b) What is the value in x[4]?
Write the value of n after execution:
char ch ='d'; int n = ch + 5;Design a class with the following specifications:
Class name: Student
Member variables:
name — name of student
age — age of student
mks — marks obtained
stream — stream allocated(Declare the variables using appropriate data types)
Member methods:
void accept() — Accept name, age and marks using methods of Scanner class.
void allocation() — Allocate the stream as per following criteria:mks stream >= 300 Science and Computer >= 200 and < 300 Commerce and Computer >= 75 and < 200 Arts and Animation < 75 Try Again void print() – Display student name, age, mks and stream allocated.
Call all the above methods in main method using an object.