Guest User

Untitled

a guest
Jan 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. package com.knowledgeblackbelt.students.ideynega.exercises;
  2.  
  3. public class Exercise342 {
  4.     public static void main(String[] args) {
  5.         String value = "Rizzo";
  6.         String result = johnConcat(value);
  7.         System.out.println(result == "RizzoJohn");
  8.         System.out.println(result.equals("RizzoJohn"));
  9.     }
  10.     private static String johnConcat(String arg) {
  11.         return arg + "John";
  12.     }
  13. }
  14. /*
  15. Execute the following steps
  16.  
  17.     Write a method called johnConcat that receives a String as parameter and returns a String. The method simply concatenates the literal String "John" to the argument and returns the result.
  18.     In a main method call your newly created method giving it an arbitrary String as argument, store the result in a local variable.
  19.     Then test the result received against the expected result with both == and .equals()
  20. */
Add Comment
Please, Sign In to add comment