40% DISCOUNT LIMITED SEATS
Java Full Stack + AI Industrial Training 2026
Expert MNC Mentors • Industrial Roadmap • 10 Seats Left
GitHub
Month 01: Lab Setup

Java & GitHub

  • Java 21 & IntelliJ AI Mastery
  • GitHub Team Industrial Flow
  • MNC Standard VS Code Setup
Logic
Month 02: Logic Lab

Logic Mastery

  • Complex DSA with MNC Experts
  • Telugu & English Logic Bridge
  • Daily Problem Solving Drills
Backend
Month 03: API Hub

Spring & SQL

  • Spring Boot 3 Microservices
  • Postman API Automated Testing
  • PostgreSQL DB Architecture
Frontend
Month 04: UI Factory

React & Tailwind

  • React 18 & AI Component Dev
  • Industrial Tailwind UI Library
  • Redux State Management
Cloud
Month 05: Deploy

AWS & Jira Hub

  • Cloud Deploy on Real AWS
  • Agile Scrum with Jira Tools
  • Jenkins CI/CD Pipeline
Success
Month 06: Result

Job Offer Letter

  • Tier-1 MNC Direct Referrals
  • Salary Negotiation Strategy
  • High CTC Placement Pipeline

Java Programs | star pattern design code | Interview coding Q&A | beginners

Yogi Siddeswara 0

Java Code :

 
  package starpatterns;

public class StarPattern1 {

  public static void main(String[] args) {
    int k = 2; // Initialize k to 2

    // Loop for rows (10 to 1)
    for (int i = 10; i >= 1; i--) {
      if (i > 5) {
        // Print decreasing asterisks for top half
        for (int j = 1; j <= i - 5; j++) {
          System.out.print("* ");
        }
      } else {
        // Print increasing asterisks for bottom half
        for (int j = 1; j < k; j++) {
          System.out.print("* ");
        }
        k++;
      }
      // Move to the next row
      System.out.println();
    }
  }
}

(code-box)

Expected Output :

  
* 
* * 
* * * 
* * * * 
* * * * * 
* * * * 
* * * 
* * 
* 
(code-box)

Post a Comment

0 Comments