Pattern programs in java part 4(Strings): learning made easy
Pattern programs in Java part 4(Strings): solved Java program for ICSE Class 10 Computer Applications with complete BlueJ code, explanation and sample output.
Pattern programs in java.
Click to learn more Patterns
A
AB
ABC
ABCD
ABCDE
package Patterns;
class p1
{
public static void main()
{
for(int i=1;i<=5;i++)
{
int alphabet=65;
for(int j=1;j<=i;j++)
{
System.out.print((char)alphabet);
alphabet++;
}
System.out.println();
}
}
}Pattern 16
J
AA
VVV
AAAA
package Patterns;
class p2
{
public static void main()
{
String str="JAVA";
int len=str.length();
for(int i=0;i<len;i++)
{
for(int j=0;j<=i;j++)
{
char val=str.charAt(i);
System.out.print(val);
}
System.out.println();
}
}
}Pattern 17
J
JA
JAV
JAVA
package Patterns;
class p3
{
public static void main()
{
String str="JAVA";
int len=str.length();
for(int i=0;i<len;i++)
{
for(int j=0;j<=i;j++)
{
char val=str.charAt(j);
System.out.print(val);
}
System.out.println();
}
}
}Pattern 18
JJJJ
AAA
VV
A
package Patterns;
class p4
{
public static void main()
{
String str="JAVA";
int len=str.length();
for(int i=0;i<len;i++)
{
for(int j=len-1;j>=i;j--)
{
char val=str.charAt(i);
System.out.print(val);
}
System.out.println();
}
}
}Pattern 19
LUEJB
UEJBL
EJBLU
JBLUE
package Patterns;
class p5
{
public static void main()
{
String str="BLUEJ";
int len=str.length();
for(int i=0;i<len-1;i++)
{
char val=str.charAt(i);
String str1=str.substring(i+1,len)+str.substring(0,i+1);
System.out.println(str1);
}
}
}Watch java videos
Related Posts
Continue learning with these related articles
Sum of First n Natural Numbers in Java (Loop and Formula)
Find the sum of the first n natural numbers in Java with a for loop, a while loop and the formula n(n + 1)/2, with a dry run and the sums of even numbers, odd numbers, squares and cubes.
Prime Number Program in Java: Check a Number and Print Primes in a Range
Check whether a number is prime in Java by counting its factors, a faster square-root method with isPrime(), and a program that prints all prime numbers in a range.

Encapsulation, Access Specifiers and Scope of Variables in Java for ICSE Class 10
ICSE Class 10 Computer Applications notes on encapsulation: private, default, protected and public access, data hiding with getter and setter methods, instance vs static (class) variables, local variables and scope, with a solved BankAccount program.