ok, so today i started practicing on codingbat.com
its great site cus u have small exercises for java.
among a lot of exercises is this one which i did last

Given a string of even length, return a string made of the middle two chars, so the string "string" yields "ri". The string length will be at least 2.

middleTwo("string") → "ri"
middleTwo("code") → "od"
middleTwo("Practice") → "ct

I succeeded in creating this program alone, thus there was not button called solution which prints code for you.

code goes like this:

public String middleTwo(String str) {

int x = str.length();
int first = (x/2)-1;
int second = (x/2)+1;
return str.substring(first, second);

Its not a big deal i know, but it is for me as im pure beginer :D