An Introduction to Network Programming with Java

An Introduction to Network Programming with Java - Xamarin...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Xamarin for Java Developers Contents This article covers the following topics: Overview Going From Java to C# Development Libraries vs. Assemblies Packages vs. Namespaces Importing Types Generics Object-Oriented Programming Features Class Inheritance Properties Calling Base Class Methods Access Modifiers Virtual and Override Methods Lamba Expressions Event Handling Asynchronous Programming Keyword Differences Interoperating with Existing Java Code For Further Reading Overview This article provides an introduction to C# programming for Java developers, focusing primarily on the C# language features that you will encounter while developing Xamarin.Android applications. Also, this article explains how these features differ from their
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Java counterparts, and it introduces important C# features (relevant to Xamarin.Android) that are not available in Java. Links to additional reference material are included, so you can use this article as a "jumping off" point for further study of C# and .NET. If you are familiar with Java, you will feel instantly at home with the syntax of C#. C# syntax is very similar to Java syntax – C# is a "curly brace" language like Java, C, and C++. In many ways, C# syntax reads like a superset of Java syntax, but with a few renamed and added keywords. Many key characteristics of Java can be found in C#: Class-based object-oriented programming Strong typing Support for interfaces Generics Garbage collection Runtime compilation Both Java and C# are compiled to an intermediate language that is run in a managed execution environment. Both C# and Java are statically-typed, and both languages treat strings as immutable types. Both languages use a single-rooted class hierarchy. Like Java, C# supports only single inheritance and does not allow for global methods. In both languages, objects are created on the heap using the new keyword, and objects are garbage-collected when they are no longer used. Both languages provide formal exception handling support with try / catch semantics. Both provide thread management and synchronization support. However, there are many differences between Java and C#. For example: Java does not support implicitly-typed local variables (C# supports the var keyword). In Java, you can pass parameters only by value, while in C# you can pass by
Image of page 2
reference as well as by value. (C# provides the ref and out keywords for passing parameters by reference; there is no equivalent to these in Java). Java does not support preprocessor directives like #define . Java does not support unsigned integer types, while C provides unsigned integer types such as ulong , uint , ushort and byte . Java does not support operator overloading; in C# you can overload operators and conversions. In a Java switch statement, code can fall through into the next switch section, but in C# the end of every switch section must terminate the switch (the end of each section must close with a break statement).
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern