Error message: "The variable top might not have been initialized", whereas I have initialized it.
package com.codegym.task.task04.task0420;
/*
Sorting three numbers
*/
import java.util.Scanner;
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
Scanner scanner = new Scanner(System.in);
int a = scanner.nextInt();
int b = scanner.nextInt();
int c = scanner.nextInt();
int top, middle, bottom;
if (a>b && a>c){
if (b>c){
top=a; middle=b; bottom=c;}
else{
top=a; middle=c; bottom=b;}}
if (b>a && b>c){
if (a>c){
top=b; middle=a; bottom=c;}
else{
top=b; middle=c; bottom=a;}}
if (c>a && c>b){
if (a>b){
top=c; middle=a; bottom=b;}
else{
top=c; middle=a; bottom=a;}}
System.out.print(top+" ");
System.out.print(middle+" ");
System.out.print(bottom);
}
}