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
igomit [66]
2 years ago
7

JAVA

Computers and Technology
1 answer:
butalik [34]2 years ago
5 0

Answer:

import java.util.*;

public class MyClass {

   public static void main(String args[]) {

       Scanner input = new Scanner(System.in);

       System.out.print("Input a word: ");

       String userinput = input.nextLine();

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

           System.out.print(userinput.charAt(i));

       }

   }

}

Explanation:

This line prompts user for input

       System.out.print("Input a word: ");

This declares a string variable named userinput and also gets input from the user

       String userinput = input.nextLine();

The following iterates through every other character of userinput from the first using iteration variable i and i is incremented by 2

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

This prints characters at i-th position

           System.out.print(userinput.charAt(i));

You might be interested in
Trish has bought a new computer that she plans to start working on after a week. Since Trish has not used computers in the past,
kotegsom [21]
Hello, I am charlespierce576! I believe I might have the answer! Simple policies such as turning of off devices not in use. Also unplugging devices during a storm.
4 0
3 years ago
What does it mean to have liability for a company?
astraxan [27]

you can get tax identification number, open a bank account and do business all under its own name


3 0
3 years ago
Prompt the user to input an integer, a double, a character, and a string, storing each into separate variables. Then, output tho
katen-ka-za [31]

Answer:

import java.util.Scanner;

public class BasicInput {

   public static void main(String[] args) {

       //Create an object of the Scanner class

       Scanner scnr = new Scanner(System.in);

       

       //Define int and double variables

       int userInt;

       double userDouble;

       

       //Define char and string variables similarly

       char userChar;

       String userString;

       

       //Prompt the user to enter an integer

      System.out.println("Enter integer:");

       //Store the input in the integer variable

       userInt = scnr.nextInt();

       

       //Prompt the user to enter a double

        System.out.println("Enter double:");

       //Store the input in the double variable

      userDouble = scnr.nextDouble();

       

       //Prompt the user to enter a char

        System.out.println("Enter char:");

       //Store the input in the char variable

      userChar = scnr.next().charAt(0);

       

       //Prompt the user to enter a string

        System.out.println("Enter String:");

       //Store the input in the string variable

      userString = scnr.next();

       

       //Output the four values on a single line

       //separated by a space

       System.out.println(userInt + " " + userDouble + " " + userChar + " " + userString);

       

   }

   

}

Sample Output:

Enter integer:

>>12

Enter double:

>>23

Enter char:

>>s

Enter String:

>>asdasd

12 23.0 s asdasd

Explanation:

The code above has been written in Java. It contains comments explaining every part of the code. Please go through the comments.

5 0
3 years ago
Whats the correct answer
dem82 [27]
Line 2 or line 4 sorry if I’m wrong
7 0
3 years ago
Read 2 more answers
Do earthquakes ever happen in Malaysia?​
adoni [48]

The correct answer to this open question is the following.

Although there are no options attached we can say the following.

Do earthquakes ever happen in Malaysia?

Yes, they do. And they are very frequent and high in intensity.

For instance, the Sabah earthquake in 2015.

On June 5, 2015, the region of Malaysia was hit by a strong earthquake, 6.0 of magnitude on the Ritcher scale. The telluric movement lasted 30 seconds and caused much destruction.

Experts and scientists confirm that this had been the strongest earthquake since the one presented in 1976.

8 0
3 years ago
Other questions:
  • In the two-level directory, if a user refers to a particular file then__________________ Select one: a. only his/her own UFD (us
    7·1 answer
  • What is the last step in conducting url search
    11·1 answer
  • Why is a DNS cache poisoning attack dangerous? Check all that apply. A. Errrr...it's not actually dangerous. B. It allows an att
    12·1 answer
  • ____________________ is the premeditated, politically motivated attacks against information, computer systems, computer programs
    6·2 answers
  • Ryan has created a Word document to be used as a review quiz for students in a classroom setting. The document contains both que
    6·1 answer
  • When you hack a website, do you enter in the master code in the html section code data, or the offline/online system?
    14·1 answer
  • When a bank account pays compound interest, it pays interest not only on the principal amount that was deposited into the accoun
    15·1 answer
  • Please code this in c++
    10·1 answer
  • Which of the following is the code of acceptable behaviors users should follow while on the Internet; that is, it is the conduct
    15·1 answer
  • What is the initial step to exploring solutions to a problem?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!