#Can't use System.out.println();

16 messages · Page 1 of 1 (latest)

dark sable
#
import java.util.Scanner;

public class Main
{
    public static class Employee
    {
        int salary = 80000;
    }

    public static void main(String[] args)
    {

    }

    public static class Programmer extends Employee
    {
        System.out.println(); // Can't use 
    }

}``` Does anyone know why? I can't
lofty compassBOT
#

This post has been reserved for your question.

Hey @dark sable! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

reef ingot
#

/run

import java.util.Scanner;

public class Main
{
    public static class Employee
    {
        int salary = 80000;
    }

    public static void main(String[] args)
    {
        new Programmer().printSalery();
    }

    public static class Programmer extends Employee
    {
        public void printSalery(){
            System.out.println(super.salary); // Can use 
        }
    }

}
quiet steepleBOT
#

Here is your java(15.0.2) output @reef ingot

80000
reef ingot
#

oh yeah

#

you need to put your code in a method

dark sable
#

I'm confused

cyan walrus
#

You can't just put it in the class?

#

When do you think it's gonna run

dark sable
#

I'm practicing Inheritance

cyan walrus
dark sable
#

I'll look at it

#

you're right ty