Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java program to print vowels in a string

String str = "hello";

//Java 8
HashSet<Character> vowels = new HashSet<>(Arrays.asList('a', 'e', 'i', 'o', 'u'));
//Java 9+
Set<Character> vowels = Set.of('a', 'e', 'i', 'o', 'u');

for(char c : str) if(vowels.contains(c)) System.out.println(c + "");
Comment

PREVIOUS NEXT
Code Example
Java :: Java If ... Else 
Java :: casting in java 
Java :: how to saperate string to array 
Java :: java final class 
Java :: Java Filters 
Java :: java remove double spaces 
Java :: java calling a method 
Java :: how to import borderlayout 
Java :: explain java coding standards for classes 
Java :: android get id of view 
Java :: java read all text from file 
Java :: public class extends implements java 
Java :: android cella 20*20 java 
Java :: bukkit e.getCurrentItem() bytes? 
Java :: nitrite get repo structure 
Sql :: mysql create user with mysql_native_password 
Sql :: sql find text in sp 
Sql :: how to truncate table with foreign key constraint 
Sql :: how to get non integer value in sql 
Sql :: view column data type sql 
Sql :: set default today mysql 
Sql :: disable foreign key constraint mysql 
Sql :: mysql drop database if exists 
Sql :: sql first day of current year 
Sql :: Found option without preceding group in config file: /etc/mysql/mariadb.conf.d/50-server.cnf at line: 1 
Sql :: find table from column name in sql 
Sql :: oracle time 24h 
Sql :: sql between date range 
Sql :: best configuration for display table in sqlplus 
Sql :: mysql increment value by 1 in update 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =