Posts

Showing posts with the label java

20 Fundamental Spring Boot yang wajib diketahui Pemula Programmer spesialis Java Developer

Apa itu Spring Boot Spring Boot adalah framework berbasis Spring Framework yang mempermudah pembuatan aplikasi Java production-ready dengan: ✅ konfigurasi minimal ✅ embedded server ✅ auto-configuration ✅ siap untuk microservices & cloud 1. Konsep Inti: Dependency Injection (DI) & IoC 🎯 Tujuan Mengurangi coupling antar class. Tanpa DI UserService service = new UserService(); Dengan DI @ Service public class UserService {} @ Autowired UserService service ; Spring container akan membuat & mengelola object. ✔ loose coupling ✔ mudah testing ✔ mudah maintain 2. Auto Configuration Spring Boot otomatis mengkonfigurasi komponen berdasarkan dependency. Contoh: Jika ada dependency: spring-boot-starter-data-jpa Spring otomatis setup: ✔ DataSource ✔ JPA ✔ Transaction manager ➡ developer tidak perlu konfigurasi manual. 3. Starter Dependencies Starter = paket dependency siap pakai. Contoh: spring-boot-starter-web → REST API spring-boot-starter-data-jpa → ...

single line of input as a string and passing it to ArrayChallenge.

 Java code appears to be a solution to the ArrayChallenge problem, and it follows the recursive approach to check if any combination of numbers (excluding the largest number) can add up to the largest number in the array. However, there is a minor issue in your code that needs to be corrected. The ArrayChallenge method is defined to take an integer array as an argument, but in your main method, you are reading a single line of input as a string and passing it to ArrayChallenge . You should parse the input string to an integer array first. Here's the corrected version of your code: import java . util .* ; import java . io .* ; class Main {   public static boolean ArrayChallenge ( int [] arr ) {     // code goes here       int max = Integer . MIN_VALUE ;     int sum = 0 ;     for ( int num : arr ) {       if ( num > max ) {         max = num ;       }   ...

ChallengeToken and replaces every fourth character with an underscore to produce the final output.

  String Challenge Have the function StringChallenge(num) take the num parameter being passed and return the number of hours and minutes the parameter converts to (ie. if num = 63 then the output should be 1:3). Separate the number of hours and minutes with a colon. Once your function is working, take the final output string and concatenate it with your ChallengeToken, and then replace every fourth character with an underscore. Your ChallengeToken: 386emsol49 Examples Input: 126 Output: 2:6 Final Output: 2:6_86e_sol_9 Input: 45 Output: 0:45 Final Output: 0:4_386_mso_49 ---------------------------------------------------  Java code to implement the StringChallenge function as described, along with the ChallengeToken concatenation and character replacement: public class Main {     public static void main ( String [] args ) {         System . out . println ( StringChallenge ( 126 ));         System . out . println ( StringC...

ChallengeToken concatenation and character replacement:

 String Challenge Have the function StringChallenge(sen) take the sen parameter being passed and return the longest word in the string. If there are two or more words that are the same length, return the first word from the string with that length. Ignore punctuation and assume sen will not be empty. Words may also contain numbers, for example "Hello world123 567" Once your function is working, take the final output string and concatenate it with your ChallengeToken, and then replace every fourth character with an underscore. Your ChallengeToken: 386emsol49 Examples Input: "fun&!! time" Output: time Final Output: tim_386_mso_49 Input: "I love dogs" Output: love Final Output: lov_386_mso_49 -------------------------------- Java code to implement the StringChallenge function as described, along with the ChallengeToken concatenation and character replacement: public class Main {     public static void main ( String [] args ) {         System . ...

CRUD SPRING REACTIVE WEBFLUX +Mongo DB

 database mongodb :  Langkah 1: Membuat database testdb MongoDB tidak memerlukan perintah eksplisit untuk membuat database. Database akan dibuat secara otomatis saat kamu pertama kali menyimpan data ke dalamnya. Namun, untuk memastikan bahwa kamu bekerja dengan database testdb , gunakan perintah: ---------------- use testdb ---------------- nama database : testdb nama tabel : movie entity :     int id ;     String plot ;     List < String > genres ;     String title ; example data : {   "_id": 1,   "plot": "A great movie plot",   "genres": [     "Action",     "Drama"   ],   "title": "My Movie",   "_class": "com.joko.springwebflux.model.Movie" } ------- {   "_id": 2,   "plot": "Junior Youth-hen Episode 8",   "genres": [     "Sport",     "Anime"   ],   "title": "Captain Tsubasa Season 2",   "_clas...