Web appOpen in Telegram
JJava Codes Basic to Advance

Java Codes Basic to Advance

@Java_Codes_Pro · channel · Tech · indexed since 2026-07-31
1 988subscribers
213posts in the index
र
राम सियाराम सियाराम जय जय राम 🙏 तुम साथ हो जो मेरे, किस चीज की कमी है ।
Jinke pass bhi Groups hain 10 members se 250 members tak ke vo mujhe de sakte hain (Only telegram groups no newly created) And don't comment here directly message me Minimum Price 50 rupye maximum price can be 100 vary based on group And in special group case it will be more @Panditsiddharth Or Call 6389680622
2.4K ·
र
राम सियाराम सियाराम जय जय राम 🙏 तुम साथ हो जो मेरे, किस चीज की कमी है ।
We have started new Channel. Is channels me aapko 8000 se lekar 1lack+ salary ke jobs achive karne ke liye kya skills required hoti hain unke bare me batayenge. Kya kya jaroori hota hai cv, experience, education and knowledge se lekar bahut kuchh Har ek field jaise accounting, Software development se lekar Har tarah ke work ki skills. To wait karne ki bajay join karlo👇 @NaukriSkills
1.2K ·
</> ᴍᴜᴋᴇsʜ </>
Write a Java program to check if a number is a palindrome in Java? import java.util.*; public class quest3 { // Write a Java program to check if a number is a palindrome in Java? ( 121 is a // palindrome,321 is not) A number is called a palindrome if the number is equal // to the reverse of a number e.g.,121 is a palindrome because the reverse of // 121 is 121 itself. On the other hand,321 is not a palindrome because the // reverse of 321 is 123, which is not equal to 321 public static void isPalindrome(int num) { int orignalnum = num; int palindrome = 0; while (num > 0) { int remind = num % 10; num = num / 10; palindrome = palindrome * 10 + remind; } System.out.print(palindrome == orignalnum); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter any number: "); int num = sc.nextInt(); isPalindrome(num); } }
3 · 1.1K ·
Reverse Decreasing Star pattern of number n ****** ***** **** *** ** * CODE : public class pattern1 { public static void reverseStar(int n) { // reverse pattern for (int i = n; i >= 0; i--) { for (int j = 1; j <= i; j++) { System.out.print("*"); } System.out.println(); } } public static void main(String[] args) { reverseStar(6); } }
3 · 1K ·
<
Print Hollow Rectangle Pattern using java . public class Hollowrect { public static void HollowrectPattern(int noOfRows, int noOfCols) { // for rows outer loop for (int i = 1; i <= noOfRows; i++) { // inner loop for (int j = 1; j <= noOfCols; j++) { // cell (i,j) if (i == 1 || i == noOfRows || j == 1 || j == noOfCols) { System.out.print("*"); } else { System.out.print(" "); } } System.out.println(); } } public static void main(String[] args) { HollowrectPattern(4, 7); } } OutPut: ******* * * * * *******
5 · 1.7K ·
</> ᴍᴜᴋᴇsʜ </>
Inverted Half Rotated Pyramid public class invertrothalfpyramid { public static void inverted_half_pyramid(int n) { // outer loop for (int i = 1; i <= n; i++) { // empty space for (int j = 1; j <= n - i; j++) { System.out.print(" "); } // star for (int j = 1; j <= i; j++) { System.out.print("*"); } System.out.println(); } } public static void main(String[] args) { // InvertedHalfPiramid(4, 4); inverted_half_pyramid(4); } } Output: * ** *** ****
2 · 1.4K ·
<
Inverted half pyramid of number . public class invertedpyra { public static void Inverted_half_pyramid(int n) { for (int i = 1; i <= n; i++) { // inner loop for (int j = 1; j <= n - i + 1; j++) { System.out.print(j); } System.out.println(); } } public static void main(String[] args) { Inverted_half_pyramid(6); } } Output: 123456 12345 1234 123 12 1
2 · 1.2K ·
Floyd`s Triangle Pattern. public class floydtriangle { public static void floyd(int n) { int count = 1; for (int i = 1; i <= n; i++) { for (int j = 1; j <= i; j++) { System.out.print(count + " "); count++; } System.out.println(); } } public static void main(String[] args) { floyd(5); } } OutPut: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
2 · 1.1K ·
0-1 Triangle Pattern public class zeroone { public static void zeroOne_Triangle(int n) { for (int i = 1; i <= n; i++) { for (int j = 1; j <= i; j++) { if ((i + j) % 2 == 0) { System.out.print("1 "); } else { System.out.print("0 "); } } System.out.println(); } } public static void main(String[] args) { zeroOne_Triangle(5); } } Output: 1 0 1 1 0 1 0 1 0 1 1 0 1 0 1
2 · 1.2K ·
Butterfly Pattern using java of number n public class Butterflypattern { public static void butterfly_pattern(int n) { for (int i = 1; i <= n; i++) { for (int j = 1; j <= i; j++) { System.out.print("*"); } for (int j = 1; j <= 2 * (n - i); j++) { System.out.print(" "); } for (int index = 1; index <= i; index++) { System.out.print("*"); } System.out.println(); } for (int i = n; i >= 1; i--) { for (int j = 1; j <= i; j++) { System.out.print("*"); } for (int j = 1; j <= 2 * (n - i); j++) { System.out.print(" "); } for (int index = 1; index <= i; index++) { System.out.print("*"); } System.out.println(); } } public static void main(String[] args) { butterfly_pattern(5); } } Output: * * ** ** *** *** **** **** ********** ********** **** **** *** *** ** ** * *
2 · 1.8K ·
Solid Rhombus Pattern for number n public class solidrhomus { public static void solidrhomus_pattern(int n) { for (int i = 1; i <= n; i++) { for (int index = 1; index <= 2 * (n - i); index++) { System.out.print(" "); } for (int index = 1; index <= n; index++) { System.out.print("* "); } System.out.println(); } } public static void main(String[] args) { solidrhomus_pattern(5); } } Output: * * * * * * * * * * * * * * * * * * * * * * * * *
2 · 1.3K ·
Hollow Rhombus Pattern for number n public class hollowrhombus { public static void hollowrhombus_pattern(int n) { for (int i = 1; i <= n; i++) { for (int j = 1; j <= n - i; j++) { System.out.print(" "); } for (int j = 1; j <= n; j++) { if (i == 1 | i == n | j == 1 | j == n) { System.out.print("*"); } else { System.out.print(" "); } } System.out.println(); } } public static void main(String[] args) { hollowrhombus_pattern(5); } } Output: ***** * * * * * * *****
2 · 1.4K ·
<
Diamond Pattern of number n public class diamond { public static void diamond_pattern(int n) { for (int i = 1; i <= n; i++) { // blank space for (int j = 1; j <= (n - i); j++) { System.out.print(" "); } // star for (int j = 1; j <= 2 * (i - 1) + 1; j++) { System.out.print("*"); } System.out.println(); } for (int i = n; i >= 1; i--) { // blank space for (int j = 1; j <= (n - i); j++) { System.out.print(" "); } // star for (int j = 1; j <= 2 * (i - 1) + 1; j++) { System.out.print("*"); } System.out.println(); } } public static void main(String[] args) { diamond_pattern(5); } } Output: * *** ***** ******* ********* ********* ******* ***** *** *
2 · 1.6K ·
</> ᴍᴜᴋᴇsʜ </>
Reverse an array public class reverseArr { public static void reverse(int numbers[]) { int start = 0; int last = numbers.length - 1; while (start < last) { int temp = numbers[last]; numbers[last] = numbers[start]; numbers[start] = temp; start++; last--; } } public static void main(String[] args) { int numbers[] = { 2, 4, 6, 8, 10, 12, 14, 16 }; reverse(numbers); for (int i = 0; i < numbers.length; i++) { System.out.print(numbers[i] + " "); } } } // time complexbilty: 0(n) // space complexbilty: 0(1) Output: 16 14 12 10 8 6 4 2
4 · 1.5K ·
<
Subarray public class subArr { public static void subArray(int numbers[]) { for (int i = 0; i < numbers.length; i++) { int start = i; // subarr for (int j = i; j < numbers.length; j++) { int end = j; // System.out.print(numbers[j]); for (int k = start; k <= end; k++) { System.out.print(+numbers[k] + " "); } System.out.println(); } System.out.println(); } } public static void main(String[] args) { int numbers[] = { 2, 4, 6, 8, 10 }; subArray(numbers); } } Output: 2 2 4 2 4 6 2 4 6 8 2 4 6 8 10 4 4 6 4 6 8 4 6 8 10 6 6 8 6 8 10 8 8 10 10
4 · 1.7K ·
<
</> ᴍᴜᴋᴇsʜ </>
Maximum Subarray sum using Kadane's Algorithm. import java.util.*; public class Kadane { public static void kaddanelgoSum(int numbers[]) { int currsum = 0; int maxsum = Integer.MIN_VALUE; for (int index = 0; index < numbers.length; index++) { currsum = currsum + numbers[index]; if (currsum < 0) { currsum = 0; } // System.out.println(currsum); // if (maxsum < currsum) { // maxsum = currsum; // } maxsum = Math.max(currsum, maxsum); } System.out.println("max sum is : " + maxsum); } public static void main(String[] args) { // int numbers[] = { 2, 3, 4, 5 }; int numbers[] = { -2, -3, 4, -1, -2, 1, 5, -3, }; kaddanelgoSum(numbers); } } Output: max sum is : 7
3 · 2.1K ·
र
राम सियाराम सियाराम जय जय राम 🙏 तुम साथ हो जो मेरे, किस चीज की कमी है ।
Poll
click to show
1 · 2.1K ·
<
</> ᴍᴜᴋᴇsʜ </>
TrapRainWater Code time complexibilty O(n) public class traprainwat { public static int trapwater(int height[]) { // left max int n = height.length; int leftMax[] = new int[n]; leftMax[0] = height[0]; for (int i = 1; i < n; i++) { leftMax[i] = Math.max(height[i], leftMax[i - 1]); } // for (int i = 0; i < n; i++) { // System.out.print(leftMax[i]); // } // right max int rightMax[] = new int[n]; rightMax[n - 1] = height[n - 1]; for (int i = n - 2; i >= 0; i--) { rightMax[i] = Math.max(rightMax[i + 1], height[i]); } // for (int i = 0; i < rightMax.length; i++) { // System.out.print(rightMax[i]); // } // loop int traprainw = 0; for (int i = 0; i < n; i++) { // waterlevel=min(leftmax,rightmax) int waterlevel = Math.min(leftMax[i], rightMax[i]); // traprainwater=waterlevel-height[i] traprainw += waterlevel - height[i]; } return traprainw; } public static void main(String[] args) { int height[] = { 4, 2, 0, 6, 3, 2, 5 }; System.out.println(trapwater(height)); } } Output: 11
5 · 2.7K ·
<
</> ᴍᴜᴋᴇsʜ </>
Best time to buy /sell any stock public class buysell { public static int buySellStock(int prices[]) { int MaxProfit = 0; int buyPrice = Integer.MAX_VALUE; for (int index = 0; index < prices.length; index++) { if (buyPrice < prices[index]) { int profit = prices[index] - buyPrice; MaxProfit = Math.max(profit, MaxProfit); } else { buyPrice = prices[index]; } } return MaxProfit; } public static void main(String[] args) { int prices[] = { 7, 1, 5, 6, 2, 3 }; System.out.println(buySellStock(prices)); } } Output: 5
5 · 3.3K ·
र
राम सियाराम सियाराम जय जय राम 🙏 तुम साथ हो जो मेरे, किस चीज की कमी है ।
Join @LogicBots For Getting Updates of our bots Sujjestion for new bot Sujjestion for new features https://t.me/logicBots
2.3K ·
र
राम सियाराम सियाराम जय जय राम 🙏 तुम साथ हो जो मेरे, किस चीज की कमी है ।
// Shows Indian Time import java.time.*; import java.time.format.DateTimeFormatter; public class ISTTime { public static void main(String[] args) { // Get current time in IST ZoneId istZone = ZoneId.of("Asia/Kolkata"); ZonedDateTime istTime = ZonedDateTime.now(istZone); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss"); System.out.println("Time (IST): " + istTime.format(formatter)); } } // Output: t.me/c/2304534698/149
2 · 2.8K ·
र
राम सियाराम सियाराम जय जय राम 🙏 तुम साथ हो जो मेरे, किस चीज की कमी है ।
New Bot @VideoCompress0bot Direct send your large size video to this bot and it will convert to small size Warning: Don't send already compressed video or low quality video other wise it will increase those size instead decreasing
3.1K ·
र
राम सियाराम सियाराम जय जय राम 🙏 तुम साथ हो जो मेरे, किस चीज की कमी है ।
Link
click to show
Sabhi log arattai app install karlo Hame apne desh ki app ko support karna chahiye Vahi pe ek doosre se bat Karo whatsapp ki bajaye Dheere dheere sare log whatsapp chhod ke arattai use karo Isme aapko hamare sare arattai app me jo groups/channels hai aur honge vo milte rahenge 👇 https://aratt.ai/@ignoustudycenter
3.6K ·

An open public feed from the search index ChatCrawler — “Google for public Telegram”; refreshed as the venue is crawled. Times are UTC.

Public content only, official Telegram API. About · FAQ · What we do not do · Remove a page · Catalog · Search · How we count