1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
telo118 [61]
3 years ago
15

. Write a short program that asks the user to input a string, and then outputs the

Computers and Technology
1 answer:
Mice21 [21]3 years ago
7 0

Answer:

// program in java.

// package

import java.util.*;

// class definition

class Main

{

// main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // object to read input from user

Scanner scr=new Scanner(System.in);

System.out.print("Enter a string:");

 // read input

String myString=scr.nextLine();

 // variable to store characters count

int char_count=0;

 // count the characters

for(int i = 0; i < myString.length(); i++) {

           if(myString.charAt(i) != ' ')

               char_count++;

       }

       // print the number of character

System.out.println("total characters in the String: "+char_count);

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read a string from user with the help of Scanner object and assign it to variable "myString".Iterate over the string and if character is not space (' ') then char_count++. After the loop print the number of characters in the string.

Output:

Enter a string:hello world

total characters in the String: 10

You might be interested in
What key do you press so you can switch tabs quickly?
ss7ja [257]
Alt and tab to switch to open applications
4 0
3 years ago
100 POINTS + BRAINLYEST TO FIRST PERSON THAT IS CORRECT!!! Tomika wants to create a cell style for her workbook and share it wit
andrew11 [14]

Answer:

Go to the Home tab on the ribbon and the group Styles.

Left Click Cell Styles, then click New Cell Style and create the style.

To share it with other workbooks, use the Merge Styles function in the same group.

Explanation:

This info was for excel.

Please mark brainliest!

6 0
3 years ago
Read 2 more answers
Mention five importance of taskbar​
sveticcg [70]

Answer:

The taskbar is an element of an operating system located at the bottom of the screen. It allows you to locate and launch programs through Start and the Start menu, or view any program that's currently open.

6 0
3 years ago
For what purpose do the hackers create the zombies army?
enyata [817]

Answer:

A. DDoS Attacks

Explanation:

A zombie, in computer terminology, is a hacker, computer worm, trojan horse, or virus compromised internet connected computer, which can be remotely directed to perform malicious tasks

E-mail spams and denial-of-service, DoS attacks are spread and launched by botnets of zombie computers

Botnets which are also known as "zombie army", are used by hackers mainly for spam and distributed-denial-of-service, DDoS, attacks

While a DoS attack involves one machine, while a DDoS attack consist of multiple computing devices and machines

A botherder is the originator of a botnet and common botnets include Mr Black. Pushdo, and cyclone

5 0
3 years ago
Please help i only have 20 minuets
MAXImum [283]

Answer:

The column to the left goes from bottom to top:  troposphere, stratosphere, mesosphere, thermosphere, exosphere.

The column to the right goes from bottom to top: Ozone layer, karman line, Exobase

Explanation: Hope this helps

4 0
3 years ago
Other questions:
  • An automobile battery, when connected to a car radio, provides 12.5 V to the radio. When connected to a set of headlights, it pr
    11·1 answer
  • What is the oldest and most common technique to differentiate information systems?
    8·1 answer
  • The _______ valve protects the air pump from reverse-exhaust pressure.
    11·1 answer
  • trhy356<br>yjetyi46ui y j4yhnpug 2utg[ 2[ 24[ou [o24t
    15·1 answer
  • You are configuring a switch that has three hosts attached to FastEthernet 0/2 through 0/4. All three hosts are part of a public
    11·1 answer
  • Which forensics tool would you use to reveal recent pages viewed via the internet explorer browser?
    10·1 answer
  • What does ;-; mean during a text?
    8·2 answers
  • A computer reads a sequence from top to bottom and left to right.
    13·1 answer
  • The Power of If Worksheet
    13·2 answers
  • 3. Which part of the computer is used<br> for typing?<br> a. Mouse<br> b. Keyboard
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!