Hey, Hi all!
I'm a bachelor student, new to Java.
Following code is giving error in PrintDetails()
What parameters should I define in it??
Kindly check and tag out my mistakes in the following code.. Thanks ^_
^

class student
{
String a;String b;char c;double d;
student(String name,String rollno,char gender,double gpa)
{
a= name; 
b= rollno;
c= gender; 
d= gpa;
}
}

class teacher
{
String e;String f;long g;String h;
teacher(String name,String address,long telephoneno,String degree)
{
e=name;
f=address;
g=telephoneno;
h=degree;
}
}

class course
{
student s1;
student s2;
teacher t1;
int age;
course(student x,student y,teacher z)
{
s1=x;
s2=y;
t1=z;
}

void printDetails()
{
System.out.println();
}
}

public class test1
{
public static void main(String args[])
{
student name=new student();
course c1=new course("aaaa","11cs11",'f',6.8);
course c2=new course("uuu","8u8",'p',7.9);
course c3=new course("uuuttt","99oi88",'m',9.7);
course j[]={c1,c2,c3};
c1. printDetails();
c2.printDetails();
c3.printDetails();
}
}

Please edit your code and add proper indentations to the code of 3-4 spaces at each level of logic nesting. There shoudl not be 2 } in line veritically.

System.out.println();

you'll need to provide a String as parameter to be printed
System.out.println("this will be printed");
for instance

This article has been dead for over six months. Start a new discussion instead.