public class Piramide {
int pisos;
String m;
void desenharPiramide(){
for(int i=1; i <=pisos; i++){
System.out.println("");
for(int j=1; j<=i;j++){
m = "*";
}
}
for(int i=1; i <=pisos; i++){
System.out.println("");
for(int j=pisos; j>=i;j--){
m = "*";
}
}
}
@Override
public String toString() {
return "Piramide{" + "m=" + m + '}';
}
}
import java.util.Scanner;
public class Principal {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
System.out.println("Digite o tamanho da piramide: ");
int pisos = sc.nextInt();
Piramide inv = new Piramide();
System.out.println(inv.m);
}
}