Professional Documents
Culture Documents
Mindtree HR
Mindtree HR
Mindtree HR
import java.util.Scanner;
public class vowel
{
public static void main(String[] args)
{
System.out.println("entert some string");
Scanner sc=new Scanner(System.in);
String str=sc.nextLine();
char []chars=str.toCharArray();
int count=0;
for(char c: chars)
{
switch(c)
{
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
count++;
break;
default:
}
}
System.out.println("number of vowels in the string"+count);
}
}
22
import java.util.*;
class max
int x=sc.nextInt();
for(int i=0;i<a.length;i++)
System.out.println("enter the"+(i+1)+"element");
int ele=sc.nextInt();
a[i]=ele;
System.out.println();
for(int i=0;i<a.length;i++)
System.out.print(a[i]+" ");
System.out.println();
int n=sc.nextInt();
int max=a[0];
if(n<=a.length)
for(int i=1;i<=n;i++)
{
if(a[i]>max)
max=a[i];
System.out.println("max is"+max);
else
System.out.println("invalid input");
Mainly used for C++ is mainly used for Java is mainly used for application
system programming. programming. It is widely used in
window, web-based, enterprise and
mobile applications.
Design Goal C++ was designed for Java was designed and created as an
systems and applications interpreter for printing systems but
programming. It was an later extended as a support network
extension of C computing. It was designed with a
programming language. goal of being easy to use and
accessible to a broader audience.
Goto C++ supports the goto Java doesn't support the goto
statement. statement.
Compiler and C++ uses compiler only. Java uses compiler and interpreter
Interpreter C++ is compiled and run both. Java source code is converted
using the compiler which into bytecode at compilation time.
converts source code into The interpreter executes this
machine code so, C++ is bytecode at runtime and produces
platform dependent. output. Java is interpreted that is why
it is platform independent.
Call by Value C++ supports both call by Java supports call by value only.
and Call by value and call by reference. There is no call by reference in java.
reference
Structure and C++ supports structures Java doesn't support structures and
Union and unions. unions.
Thread Support C++ doesn't have built-in Java has built-in thread support.
support for threads. It
relies on third-party
libraries for thread support.
Documentation C++ doesn't support Java supports documentation
comment documentation comment. comment (/** ... */) to create
documentation for java source code.
Virtual Keyword C++ supports virtual Java has no virtual keyword. We can
keyword so that we can override all non-static methods by
decide whether or not default. In other words, non-static
override a function. methods are virtual by default.
unsigned right C++ doesn't support >>> Java supports unsigned right shift
shift >>> operator. >>> operator that fills zero at the
top for the negative numbers. For
positive numbers, it works same like
>> operator.
Inheritance Tree C++ creates a new Java uses a single inheritance tree
inheritance tree always. always because all classes are the
child of Object class in java. The
object class is the root of the
inheritance tree in java.
When anyone(caller-e.g. you) tries to call anybody (e.g.your friend or receiver)in another area which is
also covered by another cell of the network by typing/dialing the mobile number of that person, mobile
number data is then constantly transmitted to network computer of the nearest mobile base station of the
caller. Immediately after verification of the number, the network computer tries to locate the person/your
friend to whom you are calling via the nearest cell and base station. When your friend is traced by the
nearest base station of your friend and When you dial that number and the corresponding ring is rung on
receiver/your friend's phone.