2
It has how to call a method within a System.out.println(" ");
?
Follows my code:
package ExerciciosReferenciaDeObjetos;
public class Aluno {
private String nome;
private int matricula;
private float n1,n2,media;
public void Aluno(String nome, int matricula, float n1, float n2){
this.nome=nome;
this.matricula=matricula;
this.n1=n1;
this.n2=n2;
}
public void Media(float n1, float n2){
float Media;
Media= (n1+n2)/2;
}
public void Exibir(){
System.out.println("Nome:"+this.nome);
System.out.println("Matrícula:"+this.matricula);
System.out.println("Nota 1:"+this.n1);
System.out.println("Nota 2:"+this.n2);
System.out.println("A média é:"+this.media()); /**no caso estou querendo chamar o método da média dentro do system.out... , mas está dando erro**/
}
Did any of the answers solve your question? Do you think you can accept one of them? Check out the [tour] how to do this, if you haven’t already. You would help the community by identifying what was the best solution for you. You can accept only one of them. But you can vote on any question or answer you find useful on the entire site (when you have enough score).
– Maniero