fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. class Metodo
  8. {
  9.  
  10. private String string;
  11. public Metodo mostrar(String nome, String sobrenome)
  12. {
  13. this.string = "Nome: " + nome + " Sobrenome: " + sobrenome;
  14. return this;
  15. }
  16. public void show()
  17. {
  18. System.out.println(this.string);
  19. }
  20. }
  21. class Ideone
  22. {
  23. public static void main (String[] args) throws java.lang.Exception
  24. {
  25. Metodo metodo = new Metodo();
  26. metodo
  27. .mostrar("Aline", "Gonzaga")
  28. .show();
  29. }
  30. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
Nome: Aline Sobrenome: Gonzaga