<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Pavan Varma</title>
    <description>The latest articles on DEV Community by Pavan Varma (@pavanvarma).</description>
    <link>https://dev.to/pavanvarma</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1950870%2Ff54b79a0-f232-484b-8f1d-0aaf601a1fdf.png</url>
      <title>DEV Community: Pavan Varma</title>
      <link>https://dev.to/pavanvarma</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pavanvarma"/>
    <language>en</language>
    <item>
      <title>Google Chrome Not Working on Windows 10 or 11? Here's What Finally Worked for Me</title>
      <dc:creator>Pavan Varma</dc:creator>
      <pubDate>Thu, 22 May 2025 10:31:03 +0000</pubDate>
      <link>https://dev.to/pavanvarma/google-chrome-not-working-on-windows-10-or-11-heres-what-finally-worked-for-me-2f2b</link>
      <guid>https://dev.to/pavanvarma/google-chrome-not-working-on-windows-10-or-11-heres-what-finally-worked-for-me-2f2b</guid>
      <description>&lt;p&gt;The Chrome browser on my Windows 10 has not been working properly for the past few months. Whenever I tried, it wouldn't open, or it would launch and freeze instantly. I tried a couple of ways to fix it, like removing the cache, reinstalling, etc. I kept pushing off, but in the meantime, I used Brave Browser, which is good. But finally, I have solved the problem. Here's how I fixed it - and how you might be able to as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔍The Problem
&lt;/h2&gt;

&lt;p&gt;Whenever I launched Chrome:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It takes time to open, or sometimes it doesn't open&lt;/li&gt;
&lt;li&gt;It &lt;strong&gt;froze&lt;/strong&gt; immediately, or&lt;/li&gt;
&lt;li&gt;It would run, but the pages wouldn't load&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I lived with this issue for months, then switched to Brave, but I always tried to fix it because Chrome is my go-to browser all the time.&lt;/p&gt;

&lt;h2&gt;
  
  
  ❌ What Didn't Work
&lt;/h2&gt;

&lt;p&gt;Before I found the fix, I tried:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reinstalling Chrome&lt;/li&gt;
&lt;li&gt;Removed all the extensions&lt;/li&gt;
&lt;li&gt;Cleared cached and profile data&lt;/li&gt;
&lt;li&gt;Restarting the laptop&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ✅ The Fix(what worked for me): Disable Graphics Acceleration
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Go to your Chrome settings&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F701ta3lbb7tpioc0tniz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F701ta3lbb7tpioc0tniz.png" alt="Chrome Settings" width="329" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, in the settings, select the &lt;strong&gt;System&lt;/strong&gt; option, and you'll see options like these or maybe other options as well.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl9nefz9llu8edcukhjhm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl9nefz9llu8edcukhjhm.png" alt="Chrome Setting/System" width="800" height="379"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I disabled the &lt;strong&gt;"Use graphics acceleration when available"&lt;/strong&gt; option, and it worked fine afterwards without any freezes occurring.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F786gb21xb73oi0fnpkz2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F786gb21xb73oi0fnpkz2.png" alt="Disabling graphics Acceleration" width="684" height="61"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After disabling it, restart &lt;strong&gt;Chrome&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  💡 Why This Happens
&lt;/h2&gt;

&lt;p&gt;I'm not sure of the exact details, but ChatGPT explained it to me in a clear and organised manner.,&lt;br&gt;
Chrome uses GPU hardware acceleration to improve performance. But on some systems - especially older laptops or those with certain GPU drivers - this can cause freezing or crashes.&lt;br&gt;
Disabling it forces Chrome to rely on CPU rendering instead, which is more stable in these cases.&lt;/p&gt;

&lt;h2&gt;
  
  
  🎉Conclusion
&lt;/h2&gt;

&lt;p&gt;I wish I had tried this sooner, but you know what? I got my Chrome working normally again, and I am very happy.&lt;br&gt;
If you're Chrome browser also didn't work properly, try disabling the Graphics acceleration first.&lt;br&gt;
Follow the steps I mentioned above :)&lt;/p&gt;

&lt;h2&gt;
  
  
  💬 Let's Connect
&lt;/h2&gt;

&lt;p&gt;Did this fix work for you? Got a different solution that helped?&lt;br&gt;
Drop a comment or connect with me - I'd love to hear your experience!&lt;/p&gt;

</description>
      <category>windows</category>
      <category>chrome</category>
      <category>productivity</category>
      <category>google</category>
    </item>
    <item>
      <title>Mastering JavaScript Functions: Declarations, Expressions, and Arrow Functions</title>
      <dc:creator>Pavan Varma</dc:creator>
      <pubDate>Mon, 24 Mar 2025 02:11:35 +0000</pubDate>
      <link>https://dev.to/pavanvarma/mastering-javascript-functions-declarations-expressions-and-arrow-functions-4h4i</link>
      <guid>https://dev.to/pavanvarma/mastering-javascript-functions-declarations-expressions-and-arrow-functions-4h4i</guid>
      <description>&lt;h2&gt;
  
  
  Introduction:
&lt;/h2&gt;

&lt;p&gt;In this article, we can master the Functions in JavaScript, including how they work internally, how to write different function types and more!&lt;/p&gt;

&lt;p&gt;So, let’s start with what is a Function exactly.&lt;/p&gt;

&lt;p&gt;In simple terms, we can say that a “Function is a block of code designed to perform a particular task“&lt;/p&gt;

&lt;h3&gt;
  
  
  Why do we use Functions?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Using functions allows us to reuse code effectively, avoiding the &lt;br&gt;
need to duplicate it repeatedly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We can write code that can be used many times&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We can use the same code with different arguments, to produce &lt;br&gt;
different results&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Syntax:
&lt;/h2&gt;

&lt;p&gt;Let’s understand the Function syntax,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function name(parameter 1, parameter 2){
    // code to be executed
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In JavaScript, a Function is defined with the function keyword, followed by a name, and followed by parentheses ().&lt;/p&gt;

&lt;p&gt;Function names can contain letters, digits, underscores, and dollar signs (same rules as variables).&lt;/p&gt;

&lt;p&gt;You understood the syntax of the function and now we can write an example of how a function works&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Example 1
function myName(){
  console.log("My name is Pavan Varma"); 
}
myName(); // this will print - My name is Pavan Varma
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we write an example of a function with parameters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Example 2
function fruitJuice(apples, oranges){
    console.log(apples, oranges);
    console.log(`Juice with ${apples} apples and ${oranges} oranges`);
}
fruitJuice(2, 3);
// it prints 
// 2, 3
// Juice with 2 apples and 3 oranges
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Different Function Types:
&lt;/h2&gt;

&lt;p&gt;There are three different writing functions, but they all work similarly: receive input data, transform data, and then output data.&lt;/p&gt;

&lt;h3&gt;
  
  
  1) Function Declaration:
&lt;/h3&gt;

&lt;p&gt;A function that can be used before it’s declared&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// function declaration example
function(birthYear){
    return 2025 - birthYear;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2) Function Expression:
&lt;/h3&gt;

&lt;p&gt;Function value that stored in a variable&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// function expression example
const calcAge = function(birthYear){
    return 2025 - birthYear;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3) Arrow Function:
&lt;/h3&gt;

&lt;p&gt;Arrow Functions are great for quick one-line functions. It has no ‘this’ keyword.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Arrow function example
const calcAge = birthYear =&amp;gt; 2025 - birthYear; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Parameters and Arguments in Functions
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In functions, parameters are placeholders to receive input values &lt;br&gt;
like local variables of a function&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Arguments are actual values of parameters to input data&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sometimes, we can assign default values to parameters. If no argument &lt;br&gt;
is passed, the default value will act as the argument.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Default parameters are introduced in ES6.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// parameters
function greet(parameter1 = 'Hey', parameter2){ 
// in parameter1 we passed a value which acts as the default parameter
    // body
}

greet('hi', 'hello'); // hi and hello are the arguments
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Return Statement:
&lt;/h2&gt;

&lt;p&gt;Whenever JavaScript reaches the return then the functions stop executing and terminate.&lt;/p&gt;

&lt;p&gt;Then, the caller will receive the return value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// return example
// sum of two numbers

function sum(a, b){
    return a + b;
}

let a = 10;
let b = 20;

const sumOfTwo = sum(a, b); // return value stores here
console.log(sumOfTwo); // prints the result
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Function Scope:
&lt;/h2&gt;

&lt;p&gt;Scope refers to the accessibility and visibility of variables within different parts of a program. It determines where variables can be used and how they are accessed in the code.&lt;/p&gt;

&lt;p&gt;In Function Scope, variables are accessible only inside the function, NOT outside.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// global scope
let language = 'JavaScript';

// function scope example
console.log(firstName); // it throws an error because the firstName is only available in myName fn
function myName(){
    let firstName = 'Pavan';
    let lastName = 'Varma';
    console.log(`${firstName}${lastName} likes ${language}`); 
    //It works here, because the language variable is a global variable
    // Pavan Varma likes JavaScript. 
}
console.log(lastName); // throws error as well..!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Function Review: Anatomy of a function:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxt3fie38h6i4xce0vl9k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxt3fie38h6i4xce0vl9k.png" alt="Function Review" width="800" height="308"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Callback Functions:
&lt;/h2&gt;

&lt;p&gt;On a simple level, Calling one function inside another is called a Callback Function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// callback function example
function calculator(a, b, fnToCall){ //(2, 5, sum)
    const ans = fnToCall(a, b); // goes to sum(2, 5) fn
    return ans; // returns to caller
}

function sum(a, b){ // sum(2, 5)
    return a + b; // 7 returns to calculator fn
}

function sub(a, b){
    return a - b;
}

function product(a, b) {
    return a * b;
}

const value = calculator(2, 5, sum); 
// Here the callback function is applied and will receive the return value
console.log(value); // prints the answer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we see some functions that act as callback functions,&lt;/p&gt;

&lt;h3&gt;
  
  
  setTimeout():
&lt;/h3&gt;

&lt;p&gt;It is a function, that is supposed to call a function after a certain duration.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// example
function greet() {
    console.log("Hello World!");
}

setTimeout(greet, 2 * 1000); // Now the greet fn will run after 2 seconds.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  setInterval():
&lt;/h3&gt;

&lt;p&gt;It is a function, that runs after runs on some interval which is given by the user.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// example
function greet() {
    console.log("Hello World!");
}
setInterval(greet, 3 * 1000); // Now the greet fn will run again and again for every 3 seconds.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Higher-Order Functions:
&lt;/h2&gt;

&lt;p&gt;A function that receives another function as an argument, that returns a new function, or both. This is only possible because of first-class functions.&lt;/p&gt;

&lt;h3&gt;
  
  
  The function that receives another function:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//We have already seen this example in the callback function that will receive fn as an argument
function greet() {
    console.log("Hey Pavan");
}
btnClose.addEventListener('click', greet); 
// Here addEventListener is a function and that receives greet as an argument which is a callback fn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The function that returns a new function:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// example
const greet = function(greeting){
    // Here the fn returning a new fn.
    return function(name){
        // The greeting parameter is accessible in this return fn.
        console.log(`${greeting} ${name}`);
    }
}
// Firstly, the greet fn will called and returns the new fn and now 
// greetHello will act as new return fn
const greetHello = greet("Hello");
greetHello("Pavan"); // prints - Hello Pavan
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Closures:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A closure is the closed-over variable environment of the execution &lt;br&gt;
context in which a function was created, even after that execution &lt;br&gt;
context is gone.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A closure gives a function access to all the variables of its parent &lt;br&gt;
function, even after that parent function has returned. The function &lt;br&gt;
keeps a reference to its outer scope, which preserves the scope chain &lt;br&gt;
throughout time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A closure is like a backpack that a function carries around wherever &lt;br&gt;
it goes. This backpack has all the variables that were present in the &lt;br&gt;
environment where the function was created.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We do NOT have to manually create a closure, this is a JavaScript &lt;br&gt;
feature that happens automatically.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We can’t even access closed-over variables explicitly.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Example 1
const a = function(){
    const x = 23;
    y = function (){
        console.log(x * 2);
    }
}
a(); // it executes upto y fn
y(); // now y fn has access to x variable even after a fn stopped executing
// prints 23 * 2 = 46
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Example 2
const secureBooking = function () {
  let passengerCount = 0;

  return function () {
    passengerCount++;
    console.log(
      `${passengerCount} ${passengerCount &amp;gt; 1 ? 'passengers' : 'passenger'}`
    );
  };
};

const booker = secureBooking();

booker(); // 1
booker(); // 2
booker(); // 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  IIFE (Immediately Invoked Function Expressions):
&lt;/h2&gt;

&lt;p&gt;An IIFE (Immediately Invoked Function Expression) is a JavaScript function that runs as soon as it is defined. It is a function that is executed immediately after its declaration, without needing to be called separately.&lt;/p&gt;

&lt;p&gt;If we ever want to run a function just once then we use IIFE.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Example
const runOnce = function(){
    console.log("This will never run again");
}
runOnce(); // this will run for one time
// but if we again call it, then it runs one more time

// IIFE
(function (){
    console.log("This will never run again");
})(); // This will only run once and then terminated..!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Summary:
&lt;/h2&gt;

&lt;p&gt;So, we covered almost every topic on Functions and if I missed anything I will write a new article for you to learn it.&lt;/p&gt;

&lt;p&gt;We covered what is Functions, Syntax, Different types of functions, Parameters and Arguments, Return statements, Function Scope, Callbacks, Higher-order functions, Closures, and IIFE.&lt;/p&gt;

&lt;p&gt;Hope you’ve learned something from this article, if you find any mistakes in the article please mention them in the comments I will fix them..!&lt;/p&gt;

&lt;p&gt;It’s been a long time since my last article but from now on I will keep posting a new article every week so you learn something, for me also it will be good practice to post something that I’ve learned&lt;/p&gt;

&lt;p&gt;Thanks for Reading this article :)&lt;/p&gt;

&lt;p&gt;I started reading Atomic Habits recently so I’m adding one line from the book that inspires you&lt;/p&gt;

&lt;p&gt;“ The most effective way to change your habits is to focus not on what you want to achieve, but on who you wish to become ”&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Learn JavaScript Basics</title>
      <dc:creator>Pavan Varma</dc:creator>
      <pubDate>Sat, 15 Feb 2025 19:00:18 +0000</pubDate>
      <link>https://dev.to/pavanvarma/learn-javascript-basics-4dil</link>
      <guid>https://dev.to/pavanvarma/learn-javascript-basics-4dil</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/pavanvarma" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1950870%2Ff54b79a0-f232-484b-8f1d-0aaf601a1fdf.png" alt="pavanvarma"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/pavanvarma/javascript-made-easy-understanding-basics-control-flow-and-loops-16eg" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;JavaScript Made Easy: Understanding Basics, Control Flow, and Loops&lt;/h2&gt;
      &lt;h3&gt;Pavan Varma ・ Feb 15&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#programming&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#100daysofcode&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>JavaScript Made Easy: Understanding Basics, Control Flow, and Loops</title>
      <dc:creator>Pavan Varma</dc:creator>
      <pubDate>Sat, 15 Feb 2025 18:59:44 +0000</pubDate>
      <link>https://dev.to/pavanvarma/javascript-made-easy-understanding-basics-control-flow-and-loops-16eg</link>
      <guid>https://dev.to/pavanvarma/javascript-made-easy-understanding-basics-control-flow-and-loops-16eg</guid>
      <description>&lt;h2&gt;
  
  
  Introduction:
&lt;/h2&gt;

&lt;p&gt;JavaScript is a high-level interpreted, object-oriented programming language created to make web pages alive.&lt;/p&gt;

&lt;p&gt;It was created by &lt;a href="https://en.wikipedia.org/wiki/Brendan_Eich" rel="noopener noreferrer"&gt;Brenda Eich&lt;/a&gt; of &lt;a href="https://en.wikipedia.org/wiki/Netscape" rel="noopener noreferrer"&gt;Netscape&lt;/a&gt; in 1995.&lt;/p&gt;

&lt;p&gt;JavaScript is an Interpreted language, whereas C++, Rust and Java are Compiled languages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Compiled vs Interpreted:
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Compiled&lt;/th&gt;
&lt;th&gt;Interpreted&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Firstly, we need to compile, and then we can run.&lt;/td&gt;
&lt;td&gt;Usually, in interpreted it runs line by line.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Here, it doesn’t compile if there is an error in the code&lt;/td&gt;
&lt;td&gt;It will run partially if the error occurs later&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Write your First JavaScript Program:
&lt;/h2&gt;

&lt;p&gt;So, we will write our first JavaScript program before we learn the fundamentals. For this open your browser and open &lt;a href="//google.com"&gt;google.com&lt;/a&gt; now right click on the tab and you will see an option called Inspect which I have shown below click on that:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F61yhahtdj2tytzjfhg62.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F61yhahtdj2tytzjfhg62.png" alt="Google Image" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you will see a pop-up open on the right side and in that, you will see a tab called console click on that your browser console will now be opened. In that write the JavaScript Program as I shown in below and press enter and your code will be logged..!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feuayzwwxzr4rkapbrhtn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feuayzwwxzr4rkapbrhtn.png" alt="browser console" width="361" height="240"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Congrats you just wrote your JavaScript code..!🎉🥳🥳&lt;br&gt;
Writing our first JavaScript code in the browser console will always be fun and exciting.&lt;/p&gt;
&lt;h2&gt;
  
  
  Variables:
&lt;/h2&gt;

&lt;p&gt;In JavaScript, variables can be declared in 4 ways:-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Automatically&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;var&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;let&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;const&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Automatically
&lt;/h3&gt;

&lt;p&gt;It means we can directly declare variables, but they are considered as Undeclared variables.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x = 4;
y = 2;
z = x + y;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember, in this way, it is not a good practice.&lt;/p&gt;

&lt;h3&gt;
  
  
  var
&lt;/h3&gt;

&lt;p&gt;It is a variable that defines the value, and it is used whenever we don't want to change the value. It is used in all JavaScript code from 1995 to 2015.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var a = 10;
var b = 15;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  let
&lt;/h3&gt;

&lt;p&gt;let is also a variable to define the value and it is used whenever we want to change the value. This “let” keyword was added to JavaScript in 2015.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let firstName = "Monkey D";
let lastName = "Luffy";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  const
&lt;/h3&gt;

&lt;p&gt;It means constant, we cannot change the value once it is defined as const, if we try to change it throws the error. This “const” keyword was also added to JS in 2015.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const age = 24;
age = 40 // throws error.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Learn to write Comments:
&lt;/h2&gt;

&lt;p&gt;Comments can be used to explain the code, and it makes users to more easily readable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// This is a single-line comment

/*
This is a multi-line comment
*/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  DataTypes:
&lt;/h2&gt;

&lt;p&gt;There are several data types in JavaScript&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;String&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Number&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Boolean&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;BigInt&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Object&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Undefined&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Null&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// String Example
let FirstName = "Goku";

// Number Example
let num = 45;

// Boolean Example
let isLoggedIn = false;

// BigInt Example
let x = BigInt("123456789012345678901234567890");

// Arrays
let arr = [35, 38, 14, 75, 8];

// Object
let user = {
    firstName: "Pavan",
    lastName:  "Varma",
    age: 24,
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we gonna take about Primitives and Non-Primitives,&lt;/p&gt;

&lt;p&gt;In simple terms, we say that Primitives are gonna stored in the stack and Non-Primtives are stored in Heap.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Primitives Example
let num = 20;
console.log(typeof num); // Number

let name = "Pavan";
console.log(typeof name); // String

let isTrue = true;
console.log(typeof isTrue); // Boolean

let firstName; // Null
let lastName;
console.log(lastName); // undefined

const sm1 = Symbol("Pavan");
console.log(sm1); // Symbol

// Non-Primitives Example
let userName = {
  firstName: "Pavan",
  isLoggedIn: true,
};
console.log(userName.firstName);
console.log(userName.lastName);

console.log(typeof userName); // Object

let arr = ["a", "pavan", "JavaScript", "HTML", "CSS", true]; // array object
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Operators:
&lt;/h2&gt;

&lt;p&gt;Most of us already know about what are the different operators, because mostly in every programming language the operators are the same.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Assignment operator (=, +=, -=, *=, ?=).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Comparison operators (&amp;gt;, &amp;gt;=, &amp;lt;, &amp;lt;=, !, !=, ==, ===)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Arithmetic operators (+, -, , /, %, **, ++, - -)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Logical operators (&amp;amp;&amp;amp;, ||, !)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I will show some of the operator examples, hope you can practice them in your code editor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let addition = 4 + 5;
let subtraction = 9 - 3;
let mul = 3 * 5;
let div = 8 / 2;
let remainder = 9 % 2;
let expo = 2 ** 4; // 2 ^ 4

let myScore = 110;
myScore++; // 111

let credits = 25;
credits--; // 24

// Comparison operator
let num1 = 3;
let num2 = 3;
let num3 = 6;

console.log(num1 == num2);
console.log(num1 != num3);
console.log(num1 &amp;gt; num3);
console.log(num1 &amp;lt; num3);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Logical operators
let isLoggedIn = true;
let isPaid = false;

console.log(isLoggedIn &amp;amp;&amp;amp; isPaid);

let isEmailUser = true;
let isGoogleUser = false;

console.log(isEmailUser || isGoogleUser);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conditions:
&lt;/h2&gt;

&lt;p&gt;Conditional statements perform different actions based on different conditions. For example, if we want to execute a code only if some condition is “true,” we will use conditional statements.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Syntax
if(condition) {
    // block of code to be executed if the condition is true;
} else {
    // this block of code executes when the if(condition) is not true;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we understand how conditions we do an example program,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//Check if a number is greater than another number:

let num1 = 5;
let num2 = 10;

if (num1 &amp;gt; num2) {
  console.log("num1 is greater than num2");
} else {
  console.log("Nope, num1 is not greater");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I will mention some challenges if you’re interested, do solve those and if you solved all of them mention&lt;/p&gt;

&lt;p&gt;“I Solved all the Conditional Challenges” in the comments :)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Check if a string is equal to another string.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check if a variable is a number or not.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check if a boolean value is true or false.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check if an array is empty or not.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Loops:
&lt;/h2&gt;

&lt;p&gt;What is Loops? So if we want to run a code over again and again, we use loops :)&lt;/p&gt;

&lt;p&gt;JavaScript Supports different kinds of Loops:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;for&lt;/strong&gt; - if we know how many times our loop iterates then we will use for loop&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;for/in&lt;/strong&gt; - loops through the properties of an object&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;for/of&lt;/strong&gt; - loops through the values of an iterable object&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;forEach&lt;/strong&gt; - this loop is used to iterate through the array&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;while&lt;/strong&gt; - if we don’t know how many times our loop iterates then we &lt;br&gt;
will use the while loop&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;do while&lt;/strong&gt; - if we want our code to be executed at least one time &lt;br&gt;
even if our condition is false then we use this.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// for loop syntax
for (expression 1; expression 2; expression 3) {
  // code block to be executed
}

// for-in syntax
for (key in object) {
  // code block to be executed
}

// for-of syntax
for (variable of iterable) {
  // code block to be executed
}

// forEach syntax
array.forEach(() =&amp;gt; {
 // code block
)};

// while syntax
while(condition) {
 // block of code to execute
}

// do-while syntax
do{
    // block of code to execute
} while(condition)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we will see some examples of these loops mentioned above,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/*
1. Write a 'for' loop that loops through the array ["green tea", "black tea", "chai", "oolong tea"].
    and stops the loop when it finds "chai".
    Store all teas before "chai" in a new array named 'selectedTrees'
*/

let teaName = ["green tea", "black tea", "chai", "oolong tea"];

let selectedTrees = [];

for (let i = 0; i &amp;lt; teaName.length; i++) {
  if (teaName[i] === "chai") {
    break;
  }
  selectedTrees.push(teaName[i]);
}
console.log(selectedTrees);

/*
2. Write a 'while' loop that calculates the sum of all numbers from 1 to 5 and stores the 
result in a variable called 'sum'. 
*/
let num = 1;

let sum = 0;
// 1+2+3+4+5
while (num &amp;lt;= 5) {
  sum += num;
  num++;
}
console.log(sum);

/*
3. Write a 'do while' loop that prompts a user to enter their favorite tea type until they enter 'stop'
  store each tea type in an array named 'teaCollection'.
*/
let teaCollection = [];

let tea;

do {
  // tea = prompt("Enter you favorite tea (type 'stop' to finish)");

  if (tea != "stop") {
    teaCollection.push(tea);
  }
} while (tea !== "stop");

/*
4. Use a 'for-of' loop to iterate through the array [1, 2, 3, 4, 5] and stop the number '4' is found.
    store the numbers before '4' in an array named 'smallNumbers'
*/

let num = [1, 2, 3, 4, 5];
let smallNumbers = [];

for (const n of num) {
  if (n == 4) {
    break;
  }
  smallNumbers.push(n);
}
console.log(smallNumbers);

/*
5. Use a 'for-in' loop to loop through an object containing city populations .
    stop the loop when the population of "berlin" is found and store all previous cities populations
    in a new object called 'cityPopulations'
*/

let citiesPopulation = {
  London: 8900000,
  "New York": 8400000,
  Paris: 2200000,
  Berlin: 3500000,
};

let cityPopulations = {};

for (const city in citiesPopulation) {
  if (city == "Berlin") {
    break;
  }
  cityPopulations[city] = citiesPopulation[city];
}
console.log(cityPopulations);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Challenges on Loops:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Write a 'for' loop that loops through the array ["london", "new &lt;br&gt;
york", "paris", "berlin"] and skips "paris". Store the other cities &lt;br&gt;
in a new array named 'visitedCities'.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use a 'for-of' loop to iterate through the array ["chai," "green &lt;br&gt;
tea," "herbal tea," and "black tea"], skipping the "herbal tea." &lt;br&gt;
Store the other teas in an array named 'preferredTeas.'&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use a 'for-in' loop to loop through an object containing city &lt;br&gt;
populations. skip any city with a population below 3 million and &lt;br&gt;
store the rest in a new object named 'largeCities'.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Write a 'forEach' loop that iterates through the array ['earl grey', &lt;br&gt;
'green tea', 'chai', 'oolong tea']. Stop the loop when 'chai' is &lt;br&gt;
found, and store all previous tea types in an array named &lt;br&gt;
'availableTeas'.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Write a 'while' loop that counts down from 5 to 1 and stores the &lt;br&gt;
numbers in an array named 'countdown'.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Conclusion:
&lt;/h2&gt;

&lt;p&gt;Yeah..! that’s it for this one, I hope you understand all the basics of JavaScript and in the next one we gonna talk about Arrays, Objects and their methods with different examples.&lt;/p&gt;

&lt;p&gt;Some of the challenges are taken from the learnings that I taken to solve and I solved them and now on you. If you want to learn in YouTube I recommend you to watch &lt;a href="https://youtube.com/playlist?list=PLRAV69dS1uWSxUIk5o3vQY2-_VKsOpXLD&amp;amp;si=7HuTKpsXyblL8NUn" rel="noopener noreferrer"&gt;Hitesh Sir Course&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope You’re all doing well, Stay Hard..!&lt;/p&gt;

&lt;p&gt;Code well and share your learnings in &lt;strong&gt;Public&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>Java Functions/Methods: A Beginner's Guide to Writing Efficient Code</title>
      <dc:creator>Pavan Varma</dc:creator>
      <pubDate>Tue, 17 Dec 2024 11:29:27 +0000</pubDate>
      <link>https://dev.to/pavanvarma/java-functionsmethods-a-beginners-guide-to-writing-efficient-code-4h9h</link>
      <guid>https://dev.to/pavanvarma/java-functionsmethods-a-beginners-guide-to-writing-efficient-code-4h9h</guid>
      <description>&lt;h2&gt;
  
  
  Intro:
&lt;/h2&gt;

&lt;p&gt;In this article, I would like to share some insights about…&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Functions/Methods Works&lt;/li&gt;
&lt;li&gt;Scoping&lt;/li&gt;
&lt;li&gt;Shadowing&lt;/li&gt;
&lt;li&gt;Function Overloading
Let's go....🙂🔥🔥✌&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frzazdkl9730lekp47nho.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frzazdkl9730lekp47nho.png" alt="Web Image from Unsplash" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Functions:
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;Function/Method&lt;/strong&gt; is a block of code that only runs when called. A method can perform some specific task without returning anything. Methods allow us to reuse the code without retyping the code. In Java, a method must be part of some class that is different from some languages like C, C++, and Python.&lt;/p&gt;

&lt;h3&gt;
  
  
  Syntax:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public static int sum(int x, int y) {
  // body
    return x + y;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0a9vjuv2yio4vweps5oz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0a9vjuv2yio4vweps5oz.png" alt="Syntax of How Function declared and Initialized in Java" width="800" height="187"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can explain functions in simple terms. Suppose we have two variables and we want to calculate their sum; we can write the code as "x + y." If we want to add two more variables, we would write the same line of code again. This can be a waste of time. Instead, we can create a function to handle the addition and then call that function in the main method. This approach makes our work easier and saves a lot of time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Main {
    public static void main(String[] args) {
         int n1  = 25;
         int n2 =  20;
         int ans = sum(n1, n2);
         System.out.println("The Sum of two numbers is: " + ans);
    }
// Here's how we declare and initialize a function.
    public static int sum(int num1, int num2){
        return num1 + num2;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we can talk about &lt;strong&gt;Method Declaration:&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Modifier:
&lt;/h2&gt;

&lt;p&gt;It specifies how your method can be accessed within your application. There are four types of access modifiers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Public&lt;/li&gt;
&lt;li&gt;Private&lt;/li&gt;
&lt;li&gt;Default&lt;/li&gt;
&lt;li&gt;Protected&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Return Type:
&lt;/h2&gt;

&lt;p&gt;A return statement causes the program control to transfer back to the caller of a method. A return type may be a primitive type like int, char, boolean (or) Void type (which returns nothing).&lt;/p&gt;

&lt;p&gt;A few important points to remember about return type,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The type of data returned by a method must be compatible with the return type specified by the method. e.g.:- If the return type of some method is boolean we cannot return an integer.&lt;/li&gt;
&lt;li&gt;The variable receiving the value returned by a method must also be compatible with the return type specified for the method.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;In Java, there is no pass-by-reference, there is only pass-by-value.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Function Name:
&lt;/h3&gt;

&lt;p&gt;When specifying the name of a function, the rules for field names also apply to function names, though the convention is slightly different.&lt;/p&gt;

&lt;h3&gt;
  
  
  Parameter-List:
&lt;/h3&gt;

&lt;p&gt;In this list input parameters are defined, preceded by their data type, within the parentheses. If there is no input we should leave it with empty parentheses.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scoping:
&lt;/h3&gt;

&lt;p&gt;Scoping refers to the visibility and lifetime of variables or functions within a program. It defines where in the code a variable or method can be accessed or used.&lt;/p&gt;

&lt;p&gt;Types of Scoping in Java:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Function Scope:&lt;/strong&gt;
A variable declared inside a method/function scope can't be accessed 
outside the method.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Main {
    public static void main(String[] args) {
        a = 20; // this shows error because 'a' variable cannot be accessed in 
// main method which declared in the function
    }
    public static int multiple(int ans) {
         int a = 1;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Block Scope:&lt;/strong&gt;
Variables declared inside blocks of code (e.g., loops, if-else blocks) are accessible only &lt;strong&gt;within that block&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class ScopeExample {
    public void display() {
        if (true) {
            int a = 5; // Block scoped variable
            System.out.println(a);
        }
        // System.out.println(a); // Error: a is not accessible outside the block
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Instance Scope:&lt;/strong&gt;
Variables declared inside a class but &lt;strong&gt;outside any method&lt;/strong&gt; are instance variables. They belong to an object (instance of a class). These variables are accessible within the class and are tied to the &lt;strong&gt;lifetime of the object&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class ScopeExample {
    int y = 20; // Instance variable
    public void display() {
        System.out.println(y); // Accessible here
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Shadowing:
&lt;/h2&gt;

&lt;p&gt;Shadowing in Java refers to the practice of using variables with the same name in overlapping scopes, where a variable in a lower-level scope overrides a variable in a higher-level scope. In this case, the variable in the higher-level scope is shadowed by the variable in the lower-level scope.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Shadowing {
    static int x = 40; // this will be shadowed at line 8
    public static void main(String[] args) {
        System.out.println(x); // 40
        int x; // the class variable at line 4 shadowed by this
//        System.out.println(x); // scope will begin when value is initialised
        x = 90;
        System.out.println(x); // 90, 
        fun(); // 40
    }

    static void fun() {
        System.out.println(x);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Variable Arguments:
&lt;/h2&gt;

&lt;p&gt;Variable Arguments are used to take a variable number of argument. A method that takes a variable number of arguments is a Varargs method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Syntax:
static void fun (int ...a) {
    // body
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, Parameters would be an array of type int[] parameters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Function Overloading:
&lt;/h2&gt;

&lt;p&gt;Function Overloading happens when a class has multiple methods with the same name but with different parameters.The methods are differentiated based on the number of parameters, types of parameters, or the order of parameters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rules for Function Overloading&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Methods must have the same name.&lt;/li&gt;
&lt;li&gt;The parameter list must be different (varying in type, number, or order of parameters).&lt;/li&gt;
&lt;li&gt;The return type alone cannot differentiate methods.&lt;/li&gt;
&lt;li&gt;Methods can have different access modifiers (public, private, etc.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class OverLoading {
    public static void main(String[] args) {
        fun(5);
        fun("Pavan");
        int ans = sum(3, 4);
        System.out.println(ans);
        int res = sum(4, 5, 6);
        System.out.println(ans);
    }

    static int sum(int a, int b) {
        return a + b;
    }

    static int sum(int a, int b, int c){
        return a + b + c;
    }

    static void fun(int a){
        System.out.println("first one");
        System.out.println(a);
    }

    static void fun(String name){
        System.out.println("second one");
        System.out.println(name);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion:
&lt;/h2&gt;

&lt;p&gt;In Java, functions are essential for optimizing code and saving developers a considerable amount of time. I hope that anyone reading this article will gain a solid understanding of functions, scoping, shadowing, and overloading. I will also provide several challenging problems for you to solve using functions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Function Practice&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Write a function that returns all prime numbers between two given numbers&lt;/li&gt;
&lt;li&gt;Define a program to find out whether a given number is even or odd.&lt;/li&gt;
&lt;li&gt;Define two methods to print the maximum and the minimum number
  respectively among three numbers entered by the user.&lt;/li&gt;
&lt;li&gt;Define a method that returns the product of two numbers entered by the user.&lt;/li&gt;
&lt;li&gt;Write a program to print the factorial of a number by defining a method.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thank you, :)&lt;/p&gt;

&lt;p&gt;STAY HARD&lt;/p&gt;

</description>
      <category>java</category>
      <category>dsa</category>
      <category>programming</category>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>Java 101: Understanding Variables, Data Types, and Input/Output</title>
      <dc:creator>Pavan Varma</dc:creator>
      <pubDate>Fri, 11 Oct 2024 11:47:20 +0000</pubDate>
      <link>https://dev.to/pavanvarma/java-101-understanding-variables-data-types-and-inputoutput-2fmc</link>
      <guid>https://dev.to/pavanvarma/java-101-understanding-variables-data-types-and-inputoutput-2fmc</guid>
      <description>&lt;h2&gt;
  
  
  Introduction:
&lt;/h2&gt;

&lt;p&gt;Java is one of the most popular and versatile programming languages in the world, and it is used in everything from web applications to mobile apps. Understanding the basics is essential if you're starting your journey into Java. In this guide, we’ll dive into three foundational concepts—variables, data types, and input/output operations—which form the backbone of any Java program. By the end of this article, I promise that you will have a clear understanding of Java and its basics.&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of Languages:
&lt;/h2&gt;

&lt;p&gt;Before we deep dive into learning Java, we must first understand how many types of languages there are. There are three types of languages, they are&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjugph2djkjbp5jmqbfl1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjugph2djkjbp5jmqbfl1.png" alt="Types of Languages" width="800" height="295"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Procedural:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Procedural language specifies a series of well-structured steps and procedures to compose a program.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It Contains a systematic order of statements, functions, and commands to complete a task.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Functional:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Writing a program entails using pure functions, which means never modifying variables but only creating new ones as output.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Used in situations where we have to perform lots of different operations on the same set of data.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Object-Oriented:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Resolves around objects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Code + Data = object.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Developed to make it easier to develop, debug, reuse, and maintain &lt;br&gt;
software.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In Conclusion to this section,&lt;/p&gt;

&lt;p&gt;“Java is predominantly an object-oriented language, but it also supports procedural and functional programming to some extent. ”&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Java?
&lt;/h2&gt;

&lt;p&gt;Java is a static programming language created by James Gosling at Sun Microsystems in 1995, Java is known for its simplicity, reliability, and portability, making it a favorite among developers for building everything from mobile apps to large-scale enterprise systems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Java code executes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before Java came into the picture languages like C, and C++ they are platform-dependent, but Java is platform-independent, which means the source code that we write will be converted into byte code.&lt;/p&gt;

&lt;p&gt;A compiler helps in doing this by turning it into executable code. This code is a set of instructions for the computer. Now, the JVM (Java Virtual Machine) converts this byte code to machine code. Here, JVM is platform-dependent.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiq7i9n2434lqi3mb7lbr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiq7i9n2434lqi3mb7lbr.png" alt="Java Executes" width="800" height="125"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Architecture:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo4peepyq2ap76nxg4599.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo4peepyq2ap76nxg4599.png" alt="Architecture" width="800" height="260"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Writing your First Java Program:
&lt;/h2&gt;

&lt;p&gt;Before diving into the main topics let’s start by writing your first Java program. A simple program that prints “Hello World!” is a great way to start programming and it’s a universal program. Anyone who starts to learn programming will start their journey by writing this program.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step-1:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before you write your first Java program, make sure you have the Java Development Kit (JDK) installed on your system. You can download it from Oracle’s website if you haven’t already.&lt;/p&gt;

&lt;p&gt;You also need an Integrated Development Environment (IDE) like Eclipse or IntelliJ IDEA to write and run your Java programs. I use Intellij&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step-2:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now, let’s write a simple Java program that prints “Hello World!” the console.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// This is a simple Java program
public class Main {
    public static void main(String[] args) {
        // Prints "Hello, World!" to the console
        System.out.println("Hello, World!");
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step-3:&lt;/p&gt;

&lt;p&gt;Now, run the code in your IDE you can get the output as:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Hello, World!&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Also, I will provide a coding question link for you to solve your first problem in Java from &lt;a href="https://www.geeksforgeeks.org/" rel="noopener noreferrer"&gt;GeeksforGeeks&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Coding Question link here: &lt;a href="https://www.geeksforgeeks.org/problems/java-hello-world4004/1?page=1&amp;amp;category=Java&amp;amp;sortBy=submissions" rel="noopener noreferrer"&gt;Hello World&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s move on to the main topics…,&lt;/p&gt;

&lt;p&gt;Variables:&lt;/p&gt;

&lt;p&gt;Variables are containers that hold data values. In Java, every variable has a type that defines the kind of data it can store.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiv8j73hgf2ft2otuffgc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiv8j73hgf2ft2otuffgc.png" alt="variable" width="800" height="317"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can declare and initialize the variable in one step;&lt;/p&gt;

&lt;h3&gt;
  
  
  Data Types:
&lt;/h3&gt;

&lt;p&gt;Type of data that can be stored in the variable. There are two Data types in Java, they are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Primitive&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Non-Primitive&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Primitive Data type:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It means any data type that cannot be broken further.&lt;/p&gt;

&lt;p&gt;Java has 8 primitive data types: int, byte, short, long, float, double, boolean, and char.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Test {
    public static void main(String[] args) {
        // Primitives
        boolean isValid = true;
        byte marks = 90;
        int num = 10;
        float weight = 70.5F;
        long views = 1_000_000_000;
        char gender = 'M';
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Non-Primitve Data type:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Non-Primitive type variables are always references.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Memory for Non-primitives is always allocated on the heap.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Members of Non-primitives get default values.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class NonPrimitives {
    public static void main(String[] args) {
        // Non primitives in java
        String s = "GeeksforGeeks";
        // others are class, object, interface, Array
        System.out.println(s);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Wrapper Classes in Java:
&lt;/h3&gt;

&lt;p&gt;A Wrapper class is a class whose object wraps (or) contains primitive data types. When we create a field and in this field, we can store primitive data types. In easy words, we can wrap a primitive value into a wrapper class object.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Character&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Byte&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Short&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Integer&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Long&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Float&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Double&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Boolean&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Type Conversion (or) Types Casting:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If the data types are compatible, then Java will perform the conversion automatically known as Automatic type conversion, and if not then they need to be cast (or) converted explicitly.&lt;/p&gt;

&lt;p&gt;Widening (or) Implicit Conversion:&lt;/p&gt;

&lt;p&gt;Widening conversion takes place when two data types are automatically converted. This happens when,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The two data types are compatible.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When we assign a value of a smaller data type to a bigger data type&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6kw8wioe0qot3huuha10.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6kw8wioe0qot3huuha10.png" alt="Implicit conversion" width="800" height="197"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Narrowing (or) Explicit Conversion:&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
If we want to assign a value of a larger data type to a smaller data type we perform explicit conversion (or) narrowing&lt;/p&gt;

&lt;p&gt;This is useful for incompatible data types where automatic conversion cannot be done.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnhkcajwwy5e4rsaa2elc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnhkcajwwy5e4rsaa2elc.png" alt="Explicit Conversion" width="800" height="115"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Input and Output:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Input:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To give some value to the system or a computer form the user is known as Input.&lt;/p&gt;

&lt;p&gt;Java has two types of Input:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Buffered Reader&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scanner&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Buffered Reader:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Buffered Reader class reads text from an input stream, buffering characters for efficient reading. While it’s often used for file input, it can also be used for reading user input from the console.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.io.*;
public class Main {
    public static void main(String[] args) throws IOException {
        // BufferedReader example
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // String example
       System.out.print("Enter a String: ");
       String s = br.readLine();
       System.out.println("You Entered: " + s);
        // Integer example
        System.out.print("Enter a Integer: ");
        int x = Integer.parseInt(br.readLine());
        System.out.println("You Entered: " + x);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Scanner:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Scanner is a class in java.util package used for obtaining the input of the primitive types like int, double, and strings. It is the easiest way to read input in a Java program, though not very efficient if you want an input method for scenarios where time is a constraint like in competitive programming.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.Scanner;
public class ScannerExample {
    public static void main(String[] args) {
        // Scanner Example
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter: ");
//        String sr = sc.nextLine();
        int n = sc.nextInt();
        System.out.println(n);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After giving the input we receive an value or something known as output. In Java we use;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;System.out.println();
System.out.print();
System.out.printf();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion:
&lt;/h3&gt;

&lt;p&gt;In this article, we have explored some of the fundamental concepts of Java, Including writing your first program. Mastering these basics is a crucial step in becoming comfortable with Java and programming in general.&lt;/p&gt;

&lt;p&gt;And that’s it we completed learning about Java fundamentals and in the next article I’m gonna help you to learn more concepts of Java. &lt;/p&gt;

&lt;p&gt;Keep pushing forward and STAY HARD!! &lt;/p&gt;

&lt;p&gt;If you liked the article share it with your friends and give a like and follow.&lt;/p&gt;

&lt;p&gt;See ya :)&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>writing</category>
      <category>tutorial</category>
      <category>java</category>
    </item>
    <item>
      <title>My Journey in Tech: September 2024 Reflections on Java, Web Development, and Growth</title>
      <dc:creator>Pavan Varma</dc:creator>
      <pubDate>Wed, 02 Oct 2024 16:15:11 +0000</pubDate>
      <link>https://dev.to/pavanvarma/my-journey-in-tech-september-2024-reflections-on-java-web-development-and-growth-1ibb</link>
      <guid>https://dev.to/pavanvarma/my-journey-in-tech-september-2024-reflections-on-java-web-development-and-growth-1ibb</guid>
      <description>&lt;h2&gt;
  
  
  Introduction:
&lt;/h2&gt;

&lt;p&gt;The Beginning of My Tech Journey:&lt;/p&gt;

&lt;p&gt;September 2024, was an important month for me as I took significant steps toward advancing my tech skills. I always wanted to learn new technology to improve my skills, but it never worked due to a lack of consistency. But this time something changed I became more determined to start and it’s good and I started learning about Java fundamentals and Web Development fundamentals simultaneously.&lt;/p&gt;

&lt;p&gt;What Sparked the Change?&lt;/p&gt;

&lt;p&gt;I believe that change or motivation doesn't happen suddenly; rather, it comes after experiencing various things. Whenever I wanted to learn something, I found that my initial motivation or desire to learn came quickly, but it didn't last long. This time, I took the time to reflect on what was hindering my learning and identified the distractions that were pulling me away from achieving my goals. &lt;/p&gt;

&lt;p&gt;Setting Goals and Making a Promise&lt;/p&gt;

&lt;p&gt;After reflecting, I set some specific learning goals and made a promise to myself to achieve them. I've been wanting to learn Data Structures and Algorithms (DSA) for a long time, but I struggled to understand them. I decided to start from scratch, which meant revisiting the basics. So, I began by learning the fundamentals of the Java programming language. Additionally, I have a strong curiosity to learn web development, so I started learning the fundamentals of it as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Turning Motivation into Action: Setting My Learning Plan:
&lt;/h2&gt;

&lt;p&gt;After deep discussion with myself and setting clear goals on areas on which I have to focus - Java, Data Structures and Algorithms (DSA), and Web Development - I knew I needed a structured approach to get the most out of my efforts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Java and DSA&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;My first goal was to build a solid foundation in Java, which I already have some knowledge of but felt I needed a deeper understanding of. I decided to focus on Data Structures and Algorithms (DSA), as I knew this would not only sharpen my coding skills but also prepare me for technical interviews in the future.&lt;/p&gt;

&lt;p&gt;I began with online resources like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;GeeksforGeeks&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Hackerrank&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Leetcode&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;for hands-on problem-solving.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Web Development&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In parallel, I also wanted to learn HTML and CSS which are fundamentals of Web Development. &lt;/p&gt;

&lt;p&gt;I utilized:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.freecodecamp.org/learn/2022/responsive-web-design/" rel="noopener noreferrer"&gt;FreeCodeCamp&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/" rel="noopener noreferrer"&gt;MDN Web Docs&lt;/a&gt;&lt;br&gt;
as my learning resources.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Overcoming challenges:
&lt;/h2&gt;

&lt;p&gt;As I started my learning journey nature suddenly attacked me with its rage “Our Area got flooded“ and for 10 Days there was no learning just tucked in our house with no electricity or anything. &lt;/p&gt;

&lt;p&gt;After the floods were over I immediately started my learning journey and went through the basics of Java and also HTML.&lt;/p&gt;

&lt;p&gt;Here are the topics I covered in &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Java:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Basics &lt;/li&gt;
&lt;li&gt;Input and Output&lt;/li&gt;
&lt;li&gt;Operators&lt;/li&gt;
&lt;li&gt;Flow Control&lt;/li&gt;
&lt;li&gt;Loops&lt;/li&gt;
&lt;li&gt;Functions/Methods&lt;/li&gt;
&lt;li&gt;Arrays&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2cin461vr1e9mlf0tso3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2cin461vr1e9mlf0tso3.png" alt="Java basics" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzrjtbq8nghiof4n76kt1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzrjtbq8nghiof4n76kt1.png" alt="Operators and Loops" width="800" height="449"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwawe5jv3y4nvcbfkwe87.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwawe5jv3y4nvcbfkwe87.png" alt="Loops" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML and CSS&lt;/strong&gt;,&lt;/p&gt;

&lt;p&gt;I covered most of the topics in HTML and CSS and also did some basic projects, &lt;/p&gt;

&lt;p&gt;Here I will share the screenshots of the basic projects that I have done using HTML and CSS&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fch8vthx9h3vhzpztqm3u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fch8vthx9h3vhzpztqm3u.png" alt="MDN Web Docs project" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjyoaq4bghrq66i79py8f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjyoaq4bghrq66i79py8f.png" alt="MDN Web Docs project" width="800" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp4wziief8uo4vqdzg352.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp4wziief8uo4vqdzg352.png" alt="FreeCodeCamp" width="800" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion: Embracing the Journey Ahead
&lt;/h2&gt;

&lt;p&gt;As I look back on September 2024, I realize how transformative this month was for my learning journey in technology. This time I not only changed myself in learning but I also started improving myself as a person. So By setting clear goals, and making promises to myself, I’ve built a strong foundation in Java, HTML, and CSS. &lt;/p&gt;

&lt;p&gt;I am committed to fulfilling the promises I make to myself and others.&lt;/p&gt;

&lt;p&gt;Moving forward, I’m excited to continue building and sharing what I’ve learned. &lt;/p&gt;

&lt;p&gt;“ Stop Breaking Promises to yourself, When you say I’m going to do something to yourself or others, and when the option comes to break the promise don’t do it. There is one win you got for the day that’s &lt;strong&gt;Action&lt;/strong&gt; “&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>java</category>
      <category>html</category>
    </item>
  </channel>
</rss>
