© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
13 replies
slayer.5995

❔ why does the output return 0

using System;

public class HelloWorld
{
    public static void Main(string[] args)
    {
        Naming n = new Naming("someone", 9);
        Console.WriteLine(n.Name + " " + n.Age);
    }
}

public class Naming
{
    public string Name;
    public int Age;
    
    public Naming (string name, int age)
    {
        name = Name; 
        age = Age;
    }
}
using System;

public class HelloWorld
{
    public static void Main(string[] args)
    {
        Naming n = new Naming("someone", 9);
        Console.WriteLine(n.Name + " " + n.Age);
    }
}

public class Naming
{
    public string Name;
    public int Age;
    
    public Naming (string name, int age)
    {
        name = Name; 
        age = Age;
    }
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Why does this function return NaN?
C#CC# / help
2y ago
❔ Why does the JsonSerializer.Deserialize return a nullable object
C#CC# / help
3y ago
❔ Why does this code always return False?
C#CC# / help
3y ago
Why does this work the way it does
C#CC# / help
8mo ago