This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jshell> public class Sample { | |
...> public int add(int a, int b) { | |
...> return a+b; | |
...> } | |
...> } | |
| created class Sample | |
jshell> Sample s = new Sample(); | |
s ==> Sample@49993335 | |
jshell> s.add(10,9); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jshell> public class Sample { | |
...> public static void join() { | |
...> StringBuilder sb = new StringBuilder(); | |
...> sb.append("Smart").append(" ").append("Techie"); | |
...> System.out.println("The string is " + sb.toString()); | |
...> } | |
...> } | |
| created class Sample | |
jshell> Sample.join(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jshell> List<String> list = new ArrayList<String>(); | |
list ==> [] | |
jshell> list.add("Smart"); | |
$2 ==> true | |
jshell> list.add("Techie"); | |
$3 ==> true | |
jshell> System.out.println("The list values are: "+ list); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jshell> List immutableList = List.of(); | |
immutableList ==> [] | |
//Add an item to the list | |
jshell> immutableList.add("Smart"); | |
| Warning: | |
| unchecked call to add(E) as a member of the raw type java.util.List | |
| immutableList.add("Smart"); | |
| ^------------------------^ | |
| java.lang.UnsupportedOperationException thrown: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jshell> Map immutableMap = Map.of(1,"Smart",2,"Techie"); | |
immutableMap ==> {1=Smart, 2=Techie} | |
//Get item from Map | |
jshell> immutableMap.get(1); | |
$2 ==> "Smart" | |
//Add item to map | |
jshell> immutableMap.put(3,"Smart_1"); | |
| Warning: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jshell> public interface Sample { | |
...> default void doSomeThing(String message) { | |
...> //Call private method | |
...> doSomeThing(); | |
...> System.out.println("The deafult interface method!!!"); | |
...> | |
...> } | |
...> | |
...> private void doSomeThing() { | |
...> System.out.println("Demonstration of interface private methods!!!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jshell> public interface Sample { | |
...> | |
...> private void doSomeThing(); | |
...> | |
...> } | |
| Error: | |
| missing method body, or declare abstract | |
| private void doSomeThing(); | |
| ^-------------------------^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jshell> List immutableList = List.of("Smart","Techie"); | |
immutableList ==> [Smart, Techie] | |
jshell> //add an item to the list | |
jshell> immutableList.add("Smart_1"); | |
| Warning: | |
| unchecked call to add(E) as a member of the raw type java.util.List | |
| immutableList.add("Smart_1"); | |
| ^--------------------------^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.samrttechie; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | |
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | |
import de.codecentric.boot.admin.config.EnableAdminServer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>de.codecentric</groupId> | |
<artifactId>spring-boot-admin-starter-client</artifactId> | |
<version>1.5.1</version> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-actuator</artifactId> | |
</dependency> |
OlderNewer