Skip to main content

Posts

Showing posts with the label java

how to save flutter form data into mysql database using spring boot

 how to save flutter form data into mysql database using spring boot Watch video:: About Us : Introducing the RealNameHidden: Your Ultimate Guide to Java, Spring Boot, Hibernate, Databases, Problem Solving, and Interview Questions! Are you passionate about Java programming and eager to expand your knowledge in the world of software development? Look no further! Welcome to the realm of RealNameHidden, your go-to destination for all things related to Java, Spring Boot, Hibernate, Databases, Problem Solving, and Interview Questions. With a wealth of experience and expertise in the field, RealNameHidden is a dedicated YouTuber committed to sharing valuable insights, practical tips, and in-depth tutorials to help you master the intricacies of Java programming and its associated technologies. Whether you're a beginner taking your first steps into the programming world or an experienced developer seeking advanced concepts, this channel is designed to cater to all skill levels. RealNameHid...

how to count a number of vowels and consonants in a given string in java

 how to count a number of vowels and consonants in a given string in java  About Us : Introducing the RealNameHidden: Your Ultimate Guide to Java, Spring Boot, Hibernate, Databases, Problem Solving, and Interview Questions! Are you passionate about Java programming and eager to expand your knowledge in the world of software development? Look no further! Welcome to the realm of RealNameHidden, your go-to destination for all things related to Java, Spring Boot, Hibernate, Databases, Problem Solving, and Interview Questions. With a wealth of experience and expertise in the field, RealNameHidden is a dedicated YouTuber committed to sharing valuable insights, practical tips, and in-depth tutorials to help you master the intricacies of Java programming and its associated technologies. Whether you're a beginner taking your first steps into the programming world or an experienced developer seeking advanced concepts, this channel is designed to cater to all skill levels. RealNameHidden...

HashMap in java | HashMap method in java with example | collections framework in java

 HashMap in java About Us : Introducing the RealNameHidden: Your Ultimate Guide to Java, Spring Boot, Hibernate, Databases, Problem Solving, and Interview Questions! Are you passionate about Java programming and eager to expand your knowledge in the world of software development? Look no further! Welcome to the realm of RealNameHidden, your go-to destination for all things related to Java, Spring Boot, Hibernate, Databases, Problem Solving, and Interview Questions. With a wealth of experience and expertise in the field, RealNameHidden is a dedicated YouTuber committed to sharing valuable insights, practical tips, and in-depth tutorials to help you master the intricacies of Java programming and its associated technologies. Whether you're a beginner taking your first steps into the programming world or an experienced developer seeking advanced concepts, this channel is designed to cater to all skill levels. RealNameHidden understands that Java programming is at the heart of modern so...

How to Remove Duplicates from ArrayList in Java | java Interview Questions

 How to Remove Duplicates from ArrayList in Java About Us : Introducing the RealNameHidden: Your Ultimate Guide to Java, Spring Boot, Hibernate, Databases, Problem Solving, and Interview Questions! Are you passionate about Java programming and eager to expand your knowledge in the world of software development? Look no further! Welcome to the realm of RealNameHidden, your go-to destination for all things related to Java, Spring Boot, Hibernate, Databases, Problem Solving, and Interview Questions. With a wealth of experience and expertise in the field, RealNameHidden is a dedicated YouTuber committed to sharing valuable insights, practical tips, and in-depth tutorials to help you master the intricacies of Java programming and its associated technologies. Whether you're a beginner taking your first steps into the programming world or an experienced developer seeking advanced concepts, this channel is designed to cater to all skill levels. RealNameHidden understands that Java programm...

many to many mapping in hibernate

 many to many mapping in hibernate Directory Structure pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.test</groupId> <artifactId>Test</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>Test</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.9</maven.compiler.source> <maven.compiler.target>1.9</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> ...

Hibernate One to Many Example using Annotation

 Hibernate One to Many Example using Annotation Directory Structure: pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.test</groupId> <artifactId>TimeStamp</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>TimeStamp</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.9</maven.compiler.source> <maven.compiler.target>1.9</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>ju...

how to save creation and updation timestamp with hibernate.

 how to save creation and updation timestamp with hibernate. for explnation watch the video : Object time stamping feature of hibernate ========================================= ->this feature keeps track of the object/record is saved/inserted initially later it also keeps track of when record/object is lastly updated/modified =>Object versioning feature keeps track how many times the object/record is modified using Hibernate persistence logic where Object timestampping feature keeps track when exactly the Object/record is inserted and lastly updated. useCases for timeStampping ========================== ->Keeping the track of when the password lastly changed ->keeping the track of when stock market share values lastly updated/modified ->Keeping the track of when last tx happend in the bank account In annotation driven HB programming ==================================== ->we can enable timestamp,version features at a time on single entity class -> in timestamp ...

Write a program to convert Dotted Decimal Notation to binary Notation in java

 Write a program to convert Dotted Decimal Notation to binary Notation in java Code: import java.util.*; class Test{ public static void main(String[] args){ Scanner scn = new Scanner(System.in); System.out.println("Enter Dotted decimal Notation:"); String dec = scn.next(); int logic = 0; String res = ""; String[] arr = dec.split("[.]",0); for(int i=0;i<arr.length;i++){ int num = Integer.parseInt(arr[i]); if(num> 255){ System.out.println("Invalid dotted decimal Notation"); logic = 1; break; } String bin = toBin(num); res = res + bin; } if(logic == 0){ System.out.println("Binary Notation "+res); } } public static String toBin(int n){ String bin = Integer.toBinaryString(n); int len = bin.length(); if(bin.length() < 8){ for(int i=0;i<8-len;i++){ bin = "0"+bin; } } return bin; } } o/p::

Write a program to Convert Binary Notation to dotted decimal Notation In java

 Write a program to Convert Binary Notation to dotted decimal Notation In java import java.util.*; class Test{                public static void main(String[] args){                               Scanner scn = new Scanner(System.in);                               System.out.println("Enter 32 bit binary Notation:");                               String bin = scn.next();                  ...

Program for the power of the number using recursion in java

 Program for the power of the number using recursion in java Code: import java.util.Scanner; public class Test{ public static void main(String[] args) { Scanner scn = new Scanner(System.in); System.out.println(power(6,3)); } public static int power(int n,int pow){ if(pow==1){ return n; } return n * power(n,pow-1); } } or == import java.util.Scanner; public class Test{ public static void main(String[] args) { Scanner scn = new Scanner(System.in); System.out.println(power(2,10)); } public static int power(int n,int pow){ if(pow==1){ return n; } if(n==0){ return 0; } if(pow%2==0){ return power(n,pow/2) * power(n,pow/2); }else{ return power(n,pow/2) * power(n,pow/2) * n; } } }

program for printing the fibonacci series upto n using recursion in java

 program for printing the fibonacci series upto n using recursion in java Code:: import java.util.Scanner; public class Test{ static int a=0,b=1,c; public static void main(String[] args) { Scanner scn = new Scanner(System.in); System.out.println("Enter the number "); int n = scn.nextInt(); if(n==1){ System.out.println(0); }else if(n==2){ System.out.println(0+" "+1); }else{ System.out.print(0+" "+1+" "); fib(n-2); } } public static void fib(int n){ if(n==0){ System.out.println(); return; } c = a+b; a = b; b = c; System.out.print(c+" "); fib(n-1); } }

program for printing the 1 to n using recursion in java

 program for printing the 1 to n using recursion in java Code: import java.util.Scanner; public class Test{ public static void main(String[] args) { Scanner scn = new Scanner(System.in); int n = scn.nextInt(); print(n); } public static void print(int n){ if(n==0){ return; } print(n-1); System.out.println(n); } } i/p: 5 o/p: 1 2 3 4 5

program for the sum of n numbers using recursion in java

 program for the sum of n numbers using recursion in java Code: import java.util.Scanner; public class Test{ public static void main(String[] args) { Scanner scn = new Scanner(System.in); int n = scn.nextInt(); System.out.println(sum(n)); } public static int sum(int n){ if(n==0){ return 0; } return n + sum(n-1); } } i/p: 5 o/p: 15 i/p: 10 o/p: 55

how to iterate hashmap in java

how to iterate hashmap in java  for explanation watch video:: 1) import java.util.*; public class Test{   public static void main(String args[])  {   HashMap<Integer,String> hm = new HashMap<>(); hm.put(1,"raja"); hm.put(2,"ram"); hm.put(3,"mohan"); hm.put(4,"roy"); for(Map.Entry<Integer,String> e : hm.entrySet()){ System.out.println(e.getKey() + " "+e.getValue()); } }    }  2) Code: import java.util.*; public class Test{   public static void main(String args[])  {   HashMap<Integer,String> hm = new HashMap<>(); hm.put(1,"raja"); hm.put(2,"ram"); hm.put(3,"mohan"); hm.put(4,"roy"); //keys for(int i : hm.keySet()){ System.out.print(i+" "); } System.out.println(); for(String s : hm.values()){ System.out.print(s+" "); } System.out.println(); }    }  3) import java.util.*...

Binary Search program in java

 Binary Search program in java Program: import java.util.*; import java.lang.*; import java.io.*; class Test{ public static void main(String[] args){ int[] arr = {-8,-3,-1,5,7,9}; System.out.println(bin(arr,5)); } public static int bin(int[] arr,int num){ int s = 0; int e = arr.length-1; while(s<=e){ int mid = (s+e)/2; if(num==arr[mid]){ return mid; }else if(num > arr[mid]){ s = mid+1; }else{ e = mid-1; } } return -1; } } Recursive  ======= Code: import java.util.*; import java.lang.*; import java.io.*; class Codechef{ public static void main(String[] args){ int[] arr = {-8,-3,-1,5,7,9}; System.out.println(rec(5,arr,0,arr.length-1)); } public static int rec(int val,int[] arr,int s,int e){ if(s<=e){ int mid = (s+e)/2; int cmp = arr[mid]; if(cmp == val){ return mid; }else if(cmp > val){ return rec(val,arr,s,mid-1); }else{ return rec(val,arr,mid+1,e); ...

java program for finding the nth fibonacci number using recursion

 java program for finding the nth fibonacci number using recursion Code:: import java.util.*; import java.lang.*; import java.io.*; class Test{ public static int fib(int n){ if(n<=1){ return n; } return fib(n-1) + fib(n-2); } public static void main(String[] args){ System.out.println(fib(7)); } }  o/p::  13 0 -> 0th fib num 1-> 1st fib num 1 -> 2nd fib num 2 -> 3rd fib num 3....>4th 5...->5th 8->6th 13-> 7th

binary to decimal conversion code in java

 binary to decimal conversion code in java Code: import java.util.*; import java.lang.*; import java.io.*; class Test{ public static void main(String[] args){ Scanner scn = new Scanner(System.in); System.out.println("Enter the Binary Number : "); int bin = scn.nextInt(); deci(bin); } public static void deci(int bin){ int res = 0; int i = 0; while(bin!=0){ int r = bin%10; res = res + (r*(int)Math.pow(2,i)); i++; bin = bin/10; } System.out.println(res); } } ex: input : 1010 o/p:  10 input : 1000 o/p: 8 i/p: 10101 o/p: 21

Decimal to Hexadecimal Conversion code in java

 Decimal to Hexadecimal Conversion Code:: import java.util.*; import java.lang.*; import java.io.*; class Test{ public static void main(String[] args){ Scanner scn = new Scanner(System.in); int dec = scn.nextInt(); hexa(dec); } public static void hexa(int dec){ String hexa = "0123456789ABCDEF"; String res = ""; while(dec!=0){ int r = dec%16; res = hexa.charAt(r) + res; dec = dec/16; } System.out.println(res); } } ex:: hexadecimal Number :: F Decimal Number :: 15 hexadecimal number : 1A decimal number : 26