<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ayush Surve on Medium]]></title>
        <description><![CDATA[Stories by Ayush Surve on Medium]]></description>
        <link>https://medium.com/@ayushsurve94?source=rss-0301bb4390bb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*AfoBFdn64ggcOpgY</url>
            <title>Stories by Ayush Surve on Medium</title>
            <link>https://medium.com/@ayushsurve94?source=rss-0301bb4390bb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 00:56:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ayushsurve94/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Java Basics for Android Development]]></title>
            <link>https://medium.com/@ayushsurve94/java-basics-for-android-development-2db263a56301?source=rss-0301bb4390bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/2db263a56301</guid>
            <dc:creator><![CDATA[Ayush Surve]]></dc:creator>
            <pubDate>Sat, 14 Mar 2026 13:47:35 GMT</pubDate>
            <atom:updated>2026-03-14T13:47:35.750Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Java Basics for Android Development</strong></p><p>Mobile application development has become one of the most influential areas in modern software engineering. Among the many platforms available, Android remains the most widely used mobile operating system in the world. Every Android application is built on a strong programming foundation, and for many developers, that foundation begins with <strong>Java</strong>.</p><p>For students learning Android development, understanding Java fundamentals is crucial. Concepts such as <strong>variables, data types, loops, conditionals, object-oriented programming, packages, and access modifiers</strong> form the building blocks of Android applications.</p><p>This blog explains these concepts in a clear, structured manner while connecting them to real Android development scenarios.</p><p><strong>1. Java Fundamentals for Android Development</strong></p><p>Before creating Android apps, developers must understand how Java manages data and controls program logic.</p><p><strong>Variables</strong></p><p>A <strong>variable</strong> is a container used to store data values in memory. In Android applications, variables help store user input, application states, or database values.</p><p><strong>Syntax</strong></p><p>dataType variableName = value;</p><p><strong>Example</strong></p><p>int age = 21;</p><p>String username = “Ayush”;</p><p>float price = 199.99f;</p><p><strong>Android Example</strong></p><p>String userInput = editText.getText().toString();</p><p>Here, the variable stores text entered by the user in an Android interface component.</p><p><strong>Data Types</strong></p><p>Data types determine the type of value that a variable can store.</p><p><strong>Primitive Data Types</strong></p><p><strong>Data Type</strong></p><p><strong>Description</strong></p><p><strong>Example</strong></p><p>int</p><p>Integer values</p><p>int count = 10</p><p>float</p><p>Decimal numbers</p><p>float price = 10.5f</p><p>double</p><p>Larger decimal values</p><p>double salary = 50000.75</p><p>char</p><p>Single character</p><p>char grade = ‘A’</p><p>boolean</p><p>True/False value</p><p>boolean isLoggedIn = true</p><p><strong>Non-Primitive Data Types</strong></p><p>These include objects and structures created by developers.</p><p>Examples include:</p><ul><li>String</li><li>Arrays</li><li>Classes</li><li>Objects</li></ul><p>Example:</p><p>String message = “Welcome to Android Development”;</p><p>In Android development, these data types help manage text inputs, user preferences, API responses, and application data.</p><p><strong>Conditional Statements</strong></p><p>Conditional statements allow applications to make decisions based on certain conditions.</p><p><strong>if Statement</strong></p><p>if(age &gt;= 18){</p><p>System.out.println(“Eligible to vote”);</p><p>}</p><p><strong>if-else Statement</strong></p><p>if(password.equals(“admin”)){</p><p>System.out.println(“Login successful”);</p><p>}else{</p><p>System.out.println(“Invalid password”);</p><p>}</p><p><strong>switch Statement</strong></p><p>int day = 2;</p><p>switch(day){</p><p>case 1:</p><p>System.out.println(“Monday”);</p><p>break;</p><p>case 2:</p><p>System.out.println(“Tuesday”);</p><p>break;</p><p>default:</p><p>System.out.println(“Invalid day”);</p><p>}</p><p><strong>Android Example</strong></p><p>if(username.isEmpty()){</p><p>Toast.makeText(this,”Username required”,Toast.LENGTH_SHORT).show();</p><p>}</p><p>This example validates user input in an Android login form.</p><p><strong>Loops</strong></p><p>Loops allow developers to execute a block of code multiple times.</p><p><strong>For Loop</strong></p><p>for(int i = 0; i &lt; 5; i++){</p><p>System.out.println(i);</p><p>}</p><p><strong>While Loop</strong></p><p>int i = 0;</p><p>while(i &lt; 5){</p><p>System.out.println(i);</p><p>i++;</p><p>}</p><p><strong>Do-While Loop</strong></p><p>int i = 0;</p><p>do{</p><p>System.out.println(i);</p><p>i++;</p><p>}while(i &lt; 5);</p><p><strong>Android Use Case</strong></p><p>Loops are commonly used when working with:</p><ul><li>Lists</li><li>RecyclerViews</li><li>Databases</li><li>Collections</li></ul><p>Example:</p><p>for(String item : itemList){</p><p>Log.d(“Item”, item);</p><p>}</p><p><strong>2. Object-Oriented Programming in Android</strong></p><p>Android development relies heavily on <strong>Object-Oriented Programming (OOP)</strong> principles. OOP helps developers organize code, reuse components, and maintain large applications efficiently.</p><p>Key OOP concepts include:</p><ul><li>Classes</li><li>Objects</li><li>Inheritance</li></ul><p><strong>Classes</strong></p><p>A <strong>class</strong> is a blueprint used to create objects. It defines properties (variables) and behaviors (methods).</p><p><strong>Example</strong></p><p>class Student {</p><p>String name;</p><p>int age;</p><p>void displayInfo(){</p><p>System.out.println(name + “ “ + age);</p><p>}</p><p>}</p><p><strong>Android Example</strong></p><p>public class MainActivity extends AppCompatActivity {</p><p>}</p><p>In Android, Activities, Services, and Fragments are all implemented using classes.</p><p><strong>Objects</strong></p><p>An <strong>object</strong> is an instance of a class.</p><p><strong>Example</strong></p><p>Student s1 = new Student();</p><p>s1.name = “Ayush”;</p><p>s1.age = 21;</p><p>s1.displayInfo();</p><p><strong>Android Example</strong></p><p>Button loginButton = new Button(this);</p><p>Objects represent real components inside an Android application.</p><p><strong>Inheritance</strong></p><p>Inheritance allows one class to acquire the properties and methods of another class. It promotes <strong>code reuse</strong> and <strong>structured programming</strong>.</p><p><strong>Example</strong></p><p>class Parent {</p><p>void show(){</p><p>System.out.println(“Parent class”);</p><p>}</p><p>}</p><p>class Child extends Parent {</p><p>void display(){</p><p>System.out.println(“Child class”);</p><p>}</p><p>}</p><p><strong>Android Example</strong></p><p>public class MainActivity extends AppCompatActivity {</p><p>}</p><p>Here, MainActivity inherits functionality from AppCompatActivity, which provides core Android activity behavior.</p><p><strong>3. Packages and Access Modifiers</strong></p><p>As Android applications grow larger, organizing code becomes essential.</p><p>Java provides <strong>packages</strong> and <strong>access modifiers</strong> to manage code structure and visibility.</p><p><strong>Packages</strong></p><p>A <strong>package</strong> is a namespace that organizes related classes and interfaces.</p><p>Example:</p><p>package com.example.studentapp;</p><p>Typical Android package structure:</p><p>com.companyname.projectname</p><p>Example:</p><p>com.ayushsurve.studentportal</p><p>Packages help developers:</p><ul><li>Organize large projects</li><li>Avoid naming conflicts</li><li>Improve maintainability</li></ul><p><strong>Access Modifiers</strong></p><p>Access modifiers control how classes, variables, and methods can be accessed.</p><p><strong>Modifier</strong></p><p><strong>Accessibility</strong></p><p>public</p><p>Accessible everywhere</p><p>private</p><p>Accessible only within the same class</p><p>protected</p><p>Accessible within the same package and subclasses</p><p>default</p><p>Accessible only within the same package</p><p><strong>Example</strong></p><p>public class User {</p><p>private String password;</p><p>public void setPassword(String password){</p><p>this.password = password;</p><p>}</p><p>}</p><p><strong>Android Example</strong></p><p>private Button submitButton;</p><p>Using private ensures that the button variable is only accessible within the activity class.</p><p><strong>Practical Use of Java Concepts in Android Apps</strong></p><p>Understanding Java fundamentals allows developers to build real Android applications such as:</p><ul><li>Login and authentication systems</li><li>Student management apps</li><li>Online examination portals</li><li>E-commerce mobile applications</li><li>Social networking platforms</li></ul><p>For example, a login feature may use:</p><ul><li>Variables to store username and password</li><li>Conditional statements for validation</li><li>Classes to define activities</li><li>Objects to represent UI components</li><li>Access modifiers to protect sensitive data</li></ul><p><strong>Conclusion</strong></p><p>Java plays a crucial role in Android development by providing the core programming principles needed to build mobile applications. Concepts such as variables, data types, loops, and conditionals help developers control application logic effectively. Meanwhile, object-oriented programming principles like classes, objects, and inheritance allow developers to create modular and reusable code.</p><p>Packages and access modifiers further enhance application structure by organizing large codebases and controlling access to important data.</p><p>For students beginning their journey in Android development, mastering these Java fundamentals is an essential first step. A strong understanding of these concepts prepares developers to explore advanced topics such as Android UI design, database integration, APIs, and modern frameworks.</p><p>By combining Java programming skills with Android development tools, developers can create powerful, scalable, and user-friendly mobile applications that address real-world problems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2db263a56301" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>