It is easy to find information, but it is not always right.
Answer:
ssume that,
Maximum “students” count can be 10.
*Driver Class*
*Solution class*
import java.util.*;
class Student {
private String name;
private int rollNo;
public String getName() {}
public void setName(String name) {}
public int getRollNo() {}
public void setRollNo(int rollNo) {}
};
class ClassRoom {
private int i;
private Student[] students;
public void addStudent(String name, int rollNo) {}
public Student[] getAllStudents() {}
};
You should really state what language you are using. I have produced your method in C#, and should be easily translatable in to any other language.
static void RotateRight<T>(T[] arr)
{
T temp = arr[arr.Length - 1];
for (int i = arr.Length - 1; i >= 0; i--)
{
if (i == 0)
arr[i] = temp;
else
arr[i] = arr[i - 1];
}
}
Answer:
Following are the calling of the given question
public static void main(String[] args) // main function
{
int store; // variable declaration
store = sum(32,15,"san"); // Calling of sum()
System.out.println(" TheValue returned by sum() : "+store); // display
}
Explanation:
Following are the description of the above statement
- Here is the name of function is sum() In the sum() function definition there are 3 parameter in there signature i.e two "int" type and 1 is "string" type .
- In the main function we declared the variable store i,e is used for storing the result of sum() it means it storing the result of value that is returning from the definition of sum() function .
- After that calling the function by there name and passing three parameter under it sum(32,15,"san"); and store in the "store" variable.
- Finally print the value by using system.out.println ().