Found 9321 Articles for Object Oriented Programming

Java Program to Capitalize the first character of each word in a String

AmitDiwan
Updated on 31-May-2024 16:49:35

7K+ Views

A string is a class of 'java.lang' package that stores a series of characters. Those characters are actually String-type objects. We must enclose the value of string within double quotes. Generally, we can represent characters in lowercase and uppercase in Java. And, it is also possible to convert lowercase characters into uppercase. This article aims to discuss a Java program to convert the first character of each word into uppercase in a string. Java program to Capitalize the first character of each word in a String Before making a Java program to convert the first lowercase character of a ... Read More

Java Program to Print X Star Pattern

AmitDiwan
Updated on 25-Jun-2024 15:53:54

8K+ Views

In this article, we will understand how to print X star pattern. The pattern is formed by using multiple for-loops and print statements. Below is a demonstration of the same: − Input Suppose our input is − Enter the number : 8 Output The desired output would be − The X star pattern : X                 X  X               X   X             X    X           X     X         X     ... Read More

Java Program to Print Half Diamond Star Pattern

AmitDiwan
Updated on 28-Feb-2022 05:38:26

889 Views

In this article, we will understand how to print half diamond star pattern. The pattern is formed by using multiple for-loops and print statements.Below is a demonstration of the same −InputSuppose our input is −Enter the number of rows : 8OutputThe desired output would be −The half diamond pattern : * ** *** **** ***** ****** ******* ******** ******* ****** ***** **** *** ** *AlgorithmStep 1 - START Step 2 - Declare three integer values namely i, j and my_input Step 3 - Read the required values from the user/ define the values Step 4 - We iterate through two ... Read More

Java Program to Print Hollow Right Triangle Star Pattern

AmitDiwan
Updated on 25-Feb-2022 13:33:52

4K+ Views

In this article, we will understand how to print hollow right triangle star pattern. The pattern is formed by using multiple for-loops and print statements. For the pyramid at the first line it will print one star, and at the last line it will print n number of stars. For other lines it will print exactly two stars at the start and end of the line, and there will be some blank spaces between these two starts.Below is a demonstration of the same −InputSuppose our input is −Enter the size : 8OutputThe desired output would be −The hollow pyramid triangle ... Read More

Java Program to Print Inverted Star Pattern

AmitDiwan
Updated on 25-Feb-2022 13:09:48

1K+ Views

In this article, we will understand how to print inverted star pattern. The pattern is formed by using multiple for-loops and print statements.Below is a demonstration of the same −InputSuppose our input is −Enter the size : 8OutputThe desired output would be −The inverted star pattern *************** ************* *********** ********* ******* ***** *** *AlgorithmStep 1 - START Step 2 - Declare four integer values namely i, j, k and my_input. Step 3 ... Read More

Java Program to Print 8 Star Pattern

AmitDiwan
Updated on 25-Feb-2022 13:04:57

614 Views

In this article, we will understand how to print 8-star pattern. The pattern is formed by using multiple for-loops and print statements.Below is a demonstration of the same −InputSuppose our input is −Enter the number : 8OutputThe desired output would be −The 8 pattern : ****** *    * *   * * * * * * * * * ****** * * * * * * * * * * * ... Read More

Java Program to Create Pyramid and Pattern

AmitDiwan
Updated on 10-Aug-2023 13:03:03

464 Views

If someone wants to build a strong foundation in Java programming language. Then, it is necessary to understand the working of loops. Also, solving the pyramid pattern problems is the best way to enhance the fundamentals of Java as it includes extensive use of the for and while loops. This article aims to provide a few Java programs to print pyramid patterns with the help of different types of loops available in Java. Java Program to Create Pyramid Patterns We are going to print the following Pyramid Patterns through Java programs − Inverted Star Pyramid Star Pyramid Numeric Pyramid ... Read More

Java Program to Print Spiral Pattern of Numbers

AmitDiwan
Updated on 25-Feb-2022 12:42:01

843 Views

In this article, we will understand how to print spiral pattern of numbers. The pattern is formed by using multiple for-loops and print statements.Below is a demonstration of the same −InputSuppose our input is −Enter the size : 5OutputThe desired output would be −The spiral pattern 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 5 5 4 3 3 3 3 3 4 5 5 3 2 2 4 2 3 4 5 5 4 3 2 1 2 3 4 5 5 4 3 2 2 2 3 4 5 ... Read More

Print Pyramid Star Pattern in Java Program

AmitDiwan
Updated on 25-Feb-2022 12:38:05

6K+ Views

In this article, we will understand how to print pyramid star pattern. The pattern is formed by using multiple for-loops and print statements.Below is a demonstration of the same −InputSuppose our input is −Enter the number of rows : 8OutputThe desired output would be −The pyramid star pattern : * * * * * * * * * * * * * * * * * * * * * * * ... Read More

Java Program to Print Square Star Pattern

AmitDiwan
Updated on 31-May-2024 17:40:27

9K+ Views

In this article, we will understand how to print square star pattern. The pattern is formed by using multiple for-loops and print statements.Below is a demonstration of the same −InputSuppose our input is −Enter the length of a side : 8OutputThe desired output would be −The square pattern : * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ... Read More

Advertisements