0% found this document useful (0 votes)
27 views1 page

Sample Mobile

Uploaded by

liseyar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views1 page

Sample Mobile

Uploaded by

liseyar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

package mobile;

import java.util.Scanner;
public class Solution {
public static void main(String[] args) {

Student[] students=new Student[4];


Scanner sc=new Scanner(System.in);
int in=sc.nextInt();sc.nextLine();
for(int i=0;i<in;i++){
int a=sc.nextInt();sc.nextLine();
String b=sc.nextLine();
int c=sc.nextInt();sc.nextLine();
int d=sc.nextInt();sc.nextInt();
students[i]=new Student(a,b,c,d);

}
int input1=sc.nextInt();sc.nextLine();
Student res1=findStudentWithMaximumAge(students);
System.out.println("id-"+res1.id);
System.out.println("name-"+res1.name);
System.out.println("marks-"+res1.marks);
System.out.println("age-"+res1.age);

Student res2=searchStudentById(students,input1);
if(res2==null)
{
System.out.println("no Students found with mention attribute");

}
else
{
System.out.println("id-"+res2.id);
System.out.println("name-"+res2.name);

You might also like