Java vs. C#

Type Example


Java
 
public class Color 
{
    String Red, Blue, Green;
}
public class Point 
{ 
    public int x, y; 
}
public interface IBase 
{
    void F();
}
public interface IDerived extends IBase 
{
    void G();
}
public class A 
{
    protected  void H() {
        System.out.println("A.H");
    }
}
public class B extends A implements IDerived  
{
    public void F() {
        System.out.println("B.F, implementation of IDerived.F");
    }
    public void G() {
        System.out.println("B.G, implementation of IDerived.G");
    }
    protected void H() {
        System.out.println("B.H, override of A.H");
    }
}
public abstract void EmptyDelegate();

import personnel.data; class Employee { private static DataSet ds; public String name; public double salary; ... }

C#
 
public enum Color
{
    Red, Blue, Green
}
public struct Point 
{ 
    public int x, y; 
}
public interface IBase
{
    void F();
}
public interface IDerived: IBase
{
    void G();
}
public class A
{
    protected virtual void H() {
        Console.WriteLine("A.H");
    }
}
public class B: A, IDerived 
{
    public void F() {
        Console.WriteLine("B.F, implementation of IDerived.F");
    }
    public void G() {
        Console.WriteLine("B.G, implementation of IDerived.G");
    }
    override protected void H() {
        Console.WriteLine("B.H, override of A.H");
    }
}
public delegate void EmptyDelegate();

using Personnel.Data; class Employee { private static DataSet ds; public string Name; public decimal Salary; ... }