Skip to content

Instantly share code, notes, and snippets.

@fida10
Created September 29, 2022 17:16
Show Gist options
  • Save fida10/6fe23925a621b7fcd66ab0e969917ceb to your computer and use it in GitHub Desktop.
Save fida10/6fe23925a621b7fcd66ab0e969917ceb to your computer and use it in GitHub Desktop.
public class scratch {
public static void main(String[] args) {
System.out.println(new scratch().defangIPaddr("1.1.1.1"));
System.out.println(new scratch().sum(5, 6));
System.out.println(new scratch().size("Hello"));
}
public String defangIPaddr(String address) {
String answer = address.replace(".", "[.]");
return answer;
}
public int sum(int a, int b){
int c = a + b;
return c;
}
public boolean size(String someString){
if(someString.length() > 5){
return true;
} else {
return false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment