Printing a returning value
<p>I've just started with Java, and so far been only playing around solving problems online, where you're not supposed to write the whole functional of a program, but only adjust a few lines of code to the already organized code.</p>

<p>However, I'm still struggling to organize my code in a compiling program in IntelliJ Idea, getting confused at,e.g. how methods invocations must be properly written.
Here's what I'm getting stuck with: an example from codingbat.com:</p>

<p><em>- Given a string, return a new string made of every other char starting with the first, so "Hello" yields "Hlo".</em></p>

<p>I've come up with a solution online, but now I wanna run it in Idea, with main method, with Scanner/BufferedReader input from console etc. Looks like I'm missing something... </p>

<pre><code>import java.util.Scanner;
public class Bat
{
    public static void main (String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        printString();
         }

    public String stringBits(String str) {
        String result = "";
        for (int i = 0; i&lt;str.length();i += 2) {
            result += str.substring(i, i+1);
        }
        return result;
    }
    public static void printString () {
        System.out.println(result);
    }
}
</code></pre>

<p>I ask your help to solve it out. What to do to make it: </p>

<ol>
<li>Read a word from a console;</li>
<li>create a new string;</li>
<li>print it out.</li>
</ol>