Answers for "how to print string char in java one by one"

0

print a letter in java

System.out.println(name.substring(1, Math.min(name.length(), 4)));
Posted by: Guest on January-27-2020
0

Java program to print the character or a letter x using star

import java.util.*;class Main{public static void main(String args[]){ int i,j,n;Scanner sc = new Scanner(System.in);System.out.println("Enter the number to print the character");n = sc.nextInt();for(i=n;i>=1;i--){for(j=i;j<n;j++){System.out.print(" ");}for(j=1;j<=(2*i-1);j++){if(j==1 || j==(2*i-1))System.out.print("*");elseSystem.out.print(" ");}System.out.println("");} for(i=2;i<=n;i++){for(j=i;j<n;j++){System.out.print(" ");}for(j=1;j<=(2*i-1);j++){if(j==1 || j==(2*i-1))System.out.print("*");elseSystem.out.print(" ");}System.out.println("");} }}
Posted by: Guest on June-24-2021

Code answers related to "how to print string char in java one by one"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language