Kick off your book project in 2 hours, get started with GhostAI in 2 hours, or do both! Free live workshops, on Zoom. You’ll leave with a real book project and a clear plan to keep going. Saturday, June 27, 2026.

Leanpub Header

Skip to main content

Mastering Programming Foundations With Python, Java, and C# Side-by-Side

A Comparative Journey Through Three Major Programming Languages

Why learn one programming language when you can understand three at once? This book introduces the foundations of programming through a powerful side-by-side comparison of Python, Java, and C#, enabling readers to build strong conceptual understanding, transferable coding skills, and a solid pathway toward modern software engineering.

Minimum price

$24.99

$34.99

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
About

About

About the Book

Programming is no longer a skill reserved for software engineers. It has become a fundamental competency for students, scientists, engineers, researchers, data analysts, and technology professionals working across virtually every discipline. Yet many learners face a common challenge: while numerous books teach a particular programming language, few help readers understand the universal principles that underlie programming itself.

Mastering the Foundations of Programming with Python, Java, and C# Side-by-Side addresses this challenge through a unique comparative approach. Rather than focusing on a single language, this book presents programming concepts simultaneously in Python, Java, and C#, enabling readers to identify common foundations, appreciate language-specific characteristics, and develop transferable programming skills that remain valuable regardless of the technology used.

Designed as the first volume of The Side-by-Side Programming Series, this book provides a comprehensive introduction to the fundamental principles of programming. Readers are progressively guided through problem solving, algorithmic thinking, variables, data types, operators, user interaction, control structures, loops, methods, arrays, and essential programming techniques. Each concept is explained clearly and illustrated through carefully selected examples implemented in the three languages, allowing readers to compare syntax, structure, and programming paradigms side by side.

The comparative methodology adopted throughout the book offers significant educational advantages. By examining the same problem from multiple language perspectives, readers develop a deeper understanding of programming concepts while avoiding the common mistake of confusing language syntax with programming logic. This approach promotes abstraction, adaptability, and long-term mastery of software development principles.

Beyond technical instruction, the book emphasizes analytical thinking, problem-solving strategies, and good programming practices. Numerous examples, exercises, and practical applications help bridge the gap between theory and implementation, making the material suitable for both self-study and academic instruction.

Whether you are a student beginning your programming journey, an educator seeking a comparative teaching resource, or an experienced professional wishing to expand your programming perspective, this book provides a structured and rigorous foundation for understanding modern software development.

By the end of this volume, readers will possess not only practical programming skills in Python, Java, and C#, but also the conceptual framework necessary to progress confidently toward object-oriented design, data structures, algorithms, and advanced software engineering topics explored in the subsequent volumes of The Side-by-Side Programming Series.

Author

About the Author

Aimé Mbobi, Ph.D.

Aimé M. Mbobi, Ph.D., is a telecommunications engineer, computer scientist, professor, researcher, technology executive, and author with more than three decades of experience in higher education, research, and the ICT industry. He holds degrees from IMT Nord Europe, the University of Lille, the École des Mines de Paris, and Paris-Saclay University. His work focuses on programming, software engineering, telecommunications, artificial intelligence, scientific computing, data structures and algorithms, numerical methods, and applied mathematics. Through his books, he seeks to combine rigorous academic foundations, comparative analysis, and real-world industrial experience to help learners develop strong technical and problem-solving skills.

Contents

Table of Contents

Table of Contents

  • Foreword — 13
  • Chapter 1 - Language Overview: Python, Java, and C# — 15
    • 1.1 Introduction — 15
      • 1.1.1 Python — 15
      • 1.1.2 Java — 15
      • 1.1.3 C# — 15
    • 1.2 Comparative Analysis — 16
      • 1.2.1 Syntax and Readability — 16
      • 1.2.2 Libraries and Ecosystem — 16
      • 1.2.3 Performance and Efficiency — 16
      • 1.2.4 Practical Applications — 17
  • Chapter 2 - Program Structure and Input/Output Mechanisms in Python, Java and C# — 19
    • 2.1 Introduction — 19
    • 2.2 Understanding Basic Program Structure Across Java, C#, and Python — 20
      • 2.2.1 Java Basic Program — 20
      • 2.2.2 Breakdown of the program — 20
      • 2.2.3 C# Basic Program — 21
      • 2.2.4 Breakdown of the program — 21
      • 2.2.5 Python Basic Program — 22
      • 2.2.6 Breakdown of the program — 23
      • 2.2.7 Comparative Synoptic Table of Java, C#, and Python Basic Programs — 24
    • 2.3 Java, C# and Python Standard Input/Output — 24
      • 2.3.1 Java Standard Input/Output — 24
      • 2.3.2 C# Standard Input/Output — 28
      • 2.3.3 Python Standard Input/Output — 31
    • 2.4 Java, C# and Python Input/Output via Dialog Boxes — 35
      • 2.4.1 Parsing Numeric Strings in Java, C#, and Python — 35
      • 2.4.2 Formatting the Output Using Dialog Boxes — 39
      • 2.4.3 Formatting the Output Using the String Method Format — 41
    • 2.5 Lab Exercise 1 — 43
    • 2.6 Solution Lab Exercise 1 — 45
    • 2.7 Lab Exercise 2 — 49
    • 2.8 Solution Lab Exercise 2 — 51
  • Chapter 3 - Lexical Structure and Tokenization in Python, Java and C# — 57
    • 3.1 Introduction — 57
    • 3.2 Tokens in Programming Languages — 58
      • 3.2.1 Tokens in Java — 58
      • 3.2.2 Tokens in C# — 59
      • 3.2.3 Tokens in Python — 59
      • 3.2.4 Compilation and Interpretation Process — 59
    • 3.3 Comments — 60
      • 3.3.1 Comments in Java Programming — 60
      • 3.3.2 Comments in C# Programming — 61
      • 3.3.3 Comments in Python Programming — 62
      • 3.3.4 Comparison of Comments in Java, C#, and Python — 63
    • 3.4 Keywords — 64
      • 3.4.1 Characteristics of Keywords — 64
      • 3.4.2 Examples of Keywords in the three Programming Languages — 64
    • 3.5 Identifiers — 65
      • 3.5.1 Characteristics of Identifiers — 65
      • 3.5.2 Identifiers in Java — 66
      • 3.5.3 Identifiers in C# — 66
      • 3.5.4 Identifiers in Python — 67
    • 3.6 Symbols or Syntax Tokens — 67
      • 3.6.1 Separators — 68
      • 3.6.2 Punctuators — 68
      • 3.6.3 Delimiters — 68
      • 3.6.4 Symbols in Java and C# — 68
      • 3.6.5 Symbols in Python — 71
      • 3.6.6 Comparison of Symbols in Python, Java and C# — 73
    • 3.7 Literals — 73
      • 3.7.1 String Literals — 73
      • 3.7.2 Character Literals — 75
      • 3.7.3 Character Literals in Python — 75
      • 3.7.4 Character Literals in Java and C# — 75
      • 3.7.5 Numeric Literals — 76
      • 3.7.6 Boolean Literals — 78
      • 3.7.7 Collection Literals — 79
    • 3.8 Lab Exercise 3 — 83
    • 3.9 Solution Lab Exercise 3 — 85
  • Chapter 4 - Operators and Expression Evaluation in Python, Java, and C# — 97
    • 4.1 Introduction — 97
    • 4.2 Operators — 98
    • 4.3 Assignment Operators — 99
      • 4.3.1 Identical Assignment Operators Across Python, Java, and C# — 99
      • 4.3.2 Python Specific Assignment Operators — 99
      • 4.3.3 Java and C# Specific Assignment Operators — 99
    • 4.4 Arithmetic Operators — 100
      • 4.4.1 Common Arithmetic Operators Across Python, Java, and C# — 100
      • 4.4.2 Python-Specific Arithmetic Operators — 100
      • 4.4.3 Examples of Arithmetic Operators in Python, Java, and C# — 101
    • 4.5 Unary Operators — 102
      • 4.5.1 Common Arithmetic Operators Across Python, Java, and C# — 102
      • 4.5.2 Python-Specific Unary Operators — 104
      • 4.5.3 Java and C# Specific Unary Operators — 105
    • 4.6 Relational Operators — 108
      • 4.6.1 Common Relational Operators Across Python, Java, and C# — 108
      • 4.6.2 Python Specific Relational Operator — 108
    • 4.7 Logical Operators — 110
      • 4.7.1 Common Logical Operators Across Python, Java, and C# — 110
      • 4.7.2 Digital Electronic Truth Tables — 110
      • 4.7.3 Short-Circuit Evaluation — 112
    • 4.8 Ternary Operators — 113
      • 4.8.1 Ternary Operator in Java and C# — 114
      • 4.8.2 Ternary Operator in Python — 114
    • 4.9 Bitwise and Shift Operators — 115
      • 4.9.1 Common Bitwise Operators Across Python, Java, and C# — 115
      • 4.9.2 Bitwise Shift Operators — 116
    • 4.10 Membership Operators — 117
      • 4.10.1 Python Membership Operators — 117
      • 4.10.2 Java Membership Equivalent — 118
      • 4.10.3 C# Membership Equivalent — 118
    • 4.11 Operator Precedence — 119
      • 4.11.1 Unary Operators (!, +, -) — 119
      • 4.11.2 Multiplication, Division, Modulus (*, /, %) — 120
      • 4.11.3 Addition and Subtraction (+, -) — 120
      • 4.11.4 Relational Operators (<, <=, >=, >) — 121
      • 4.11.5 Equality Operators (==, !=) — 122
      • 4.11.6 Logical AND (&&) — 122
      • 4.11.7 Logical OR (||) — 123
      • 4.11.8 Assignment (=) — 123
    • 4.12 Lab Exercise 4 — 125
    • 4.13 Solution Lab Exercise 4 — 128
  • Chapter 5 - Data Representation and Memory Models in Python, Java, and C# — 143
    • 5.1 Introduction — 143
    • 5.2 Primitive Types — 144
      • 5.2.1 Java Primitive Types — 144
      • 5.2.2 C# Primitive Types — 145
      • 5.2.3 Python Primitive Types — 145
      • 5.2.4 Comparison of Primitive Types — 146
    • 5.3 Type Conversion (Casting) — 147
      • 5.3.1 Implicit Type Conversion (Automatic Conversion) — 147
      • 5.3.2 Explicit Type Conversion (Casting) — 147
    • 5.4 Objectives of Data Handling in Programming — 151
    • 5.5 Named Constants and Variables — 151
      • 5.5.1 Named Constants — 151
      • 5.5.2 Variables — 151
    • 5.6 Memory Allocation — 152
      • 5.6.1 Concept — 152
      • 5.6.2 Storing Data into Named Constant — 152
      • 5.6.3 Storing Data in Variables — 153
    • 5.7 Memory Allocation and Data Storage — 156
      • 5.7.1 Memory Allocation and Data Storage in Java — 156
      • 5.7.2 Memory Allocation and Data Storage in C# — 157
      • 5.7.3 Memory Allocation and Data Storage in Python — 158
    • 5.8 Memory Management — 159
      • 5.8.1 Memory Management in Java and C# — 159
      • 5.8.2 Memory Management in Python — 159
    • 5.9 Comparing Floating-point Numbers for Equality — 160
      • 5.9.1 Comparing Floating-point Numbers for Equality in Java — 160
      • 5.9.2 Comparing Floating-point Numbers for Equality in C# — 160
      • 5.9.3 Comparing Floating-point Numbers for Equality in Python — 161
    • 5.10 Lab Exercise 5 — 162
    • 5.11 Solution Lab Exercise 5 — 165
  • Chapter 6 - Control Flow Semantics and Execution Structures in Python, Java, and C# — 177
    • 6.1 Introduction — 177
    • 6.2 Understanding Control Structures in Programming — 178
    • 6.3 Types of Control Structures — 179
    • 6.4 Selection Structures — 180
      • 6.4.1 One-Way Selection — 180
      • 6.4.2 Two-Way Selection — 182
      • 6.4.3 Behavior of If Statements Without Curly Braces in Java and C# — 184
      • 6.4.4 Nested if and if-elif-else in Python, Java, and C# — 186
      • 6.4.5 Rule to Pair an else with an if in Java and C# — 191
      • 6.4.6 Rule to Pair an else with an if in Python — 192
      • 6.4.7 Match-Case (Python) and Switch-Case (Java and C#) — 193
    • 6.5 Repetition Structures — 198
      • 6.5.1 For Looping Structure — 198
      • 6.5.2 While Looping Structure — 206
      • 6.5.3 do … while Looping Structure — 217
      • 6.5.4 Comparative Analysis of Repetition Structures — 220
    • 6.6 Method Calls — 221
      • 6.6.1 Method Calls in Java — 221
      • 6.6.2 Method Calls in C# — 222
      • 6.6.3 Method Calls in Python — 222
    • 6.7 Lab Exercise 6 — 224
    • 6.8 Solution Lab Exercise 6 — 227
    • 6.9 Lab Exercise 7 — 233
  • Chapter 7 - Arrays and Sequential Data Structures in Python, Java, and C# — 243
    • 7.1 Introduction — 243
    • 7.2 Array Definition — 244
    • 7.3 Arrays and their Components — 245
    • 7.4 Size of an Array — 246
    • 7.5 Array Declaration — 246
      • 7.5.1 Declaring an Array in Java — 246
      • 7.5.2 Declaring an Array in C# — 247
      • 7.5.3 Declaring an Array in Python — 247
    • 7.6 Array memory allocation — 247
      • 7.6.1 Array memory allocation in Java and C# — 247
      • 7.6.2 Array memory allocation in Python — 248
      • 7.6.3 Key Differences in Memory Allocation — 249
    • 7.7 Array Initialization — 249
      • 7.7.1 Initializing an Array in Java and C# — 249
      • 7.7.2 Initializing an Array in Python — 252
    • 7.8 Understanding Array Size in Java, C#, and Python — 253
      • 7.8.1 Array Size in Java — 253
      • 7.8.2 Array Size in C# — 254
      • 7.8.3 Array Size in Python — 255
      • 7.8.4 Comparing Array Size Handling Across Java, C#, and Python — 255
    • 7.9 Accessing Array Elements — 256
      • 7.9.1 General Concept of Array Indexing — 256
      • 7.9.2 Accessing Array Elements in Java — 256
      • 7.9.3 Accessing Array Elements in C# — 257
      • 7.9.4 Accessing Array Elements in Python — 257
      • 7.9.5 Array Operations in Java, C# and Python — 258
    • 7.10 Lab Exercise 8 — 265
    • 7.11 Solution Lab Exercise 8 — 268
    • 7.12 Lab Exercise 9 — 271
    • 7.13 Solution Lab Exercise 9 — 273
    • 7.14 Lab Exercise 10 — 276
    • 7.15 Solution Lab Exercise 10 — 280
  • About the Author — 287
  • The Side-by-Side Programming Series — 288
  • Author’s Publishing Collections — 289

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub