Computer Applications
(a) Name one String method which results in positive integer only.
(b) Name one String method which results in a character.
Related Questions
Convert the given loop into exit-controlled loop.
int a, b; for(a = 10, b = 1; a >= 1; a -= 2){ b += a; b++; } System.out.print(b);Consider and give the output of the following program:
class report{ int a, b; report(){ a = 10; b = 15; } report(int x, int y){ a = x; b = y; } void print(){ System.out.println(a * b); } static void main(){ report r = new report(); r.print(); report p = new report(4, 5); p.print(); } }class area{ double area(double r, double h){ double l, a; a = 22.0 / 7 * r * l; l = Math.sqrt(r * r + h * h); return a; } }Specify the type of the error in the above program, correct and write the program to be error free.
Consider the following array and answer the questions given below:
int a[] = {12, 10, 8, 4, 6, 2, 3, 5, 7};
(a) What is the output of System.out.print(a[0] + a[5]);?
(b) What is the index (subscript) of the largest element of the array a[]?