<?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"><channel><title><![CDATA[lets-programming]]></title><description><![CDATA[pratiks-desk]]></description><link>https://lets-programming.pratiks-desk.in</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1741913486540/0b73b2ef-4e66-4c65-9d96-8a26dd7ec151.png</url><title>lets-programming</title><link>https://lets-programming.pratiks-desk.in</link></image><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 21:10:18 GMT</lastBuildDate><atom:link href="https://lets-programming.pratiks-desk.in/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[First Selenium Program: Launching a Browser using Java]]></title><description><![CDATA[Learn how to launch a browser with Selenium using Java. Perfect for beginners in web automation testing. Start your automated testing journey today!]]></description><link>https://lets-programming.pratiks-desk.in/first-selenium-program-launching-a-browser-using-java</link><guid isPermaLink="true">https://lets-programming.pratiks-desk.in/first-selenium-program-launching-a-browser-using-java</guid><category><![CDATA[selenium]]></category><category><![CDATA[selenium-webdriver]]></category><category><![CDATA[Selenium java]]></category><category><![CDATA[selenium testing]]></category><category><![CDATA[Software Testing]]></category><category><![CDATA[automation testing ]]></category><category><![CDATA[qa testing]]></category><dc:creator><![CDATA[Pratik J]]></dc:creator><pubDate>Tue, 17 Jun 2025 06:12:09 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1750140110666/93dd0132-e28e-4bbc-8480-70b140ff48d4.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction">📌 Introduction</h2>
<p>Selenium is a popular open-source tool for automating web browsers. If you're just getting started in automation testing or want to understand how browser automation works using Java, this post is for you.</p>
<p>In this quick guide, we’ll walk through a simple Selenium program that opens a browser — your first step toward automated testing.</p>
<hr />
<h2 id="heading-prerequisites">🧰 Prerequisites</h2>
<p>Before writing your first script, make sure you have:</p>
<ul>
<li><p>✅ <strong>Java JDK</strong> installed (Java 8 or later)</p>
</li>
<li><p>✅ <strong>Eclipse</strong> or any Java IDE</p>
</li>
<li><p>✅ <strong>Selenium WebDriver</strong> JAR files added to your project</p>
</li>
<li><p>✅ A browser driver like <strong>ChromeDriver</strong><br />  <em>(📝 From Selenium 4+, the driver is handled automatically, so downloading or adding it to system path is usually not necessary unless you're using a custom setup)</em></p>
</li>
</ul>
<hr />
<h2 id="heading-code-launching-chrome-browser">👨‍💻 Code: Launching Chrome Browser</h2>
<pre><code class="lang-java"><span class="hljs-keyword">import</span> org.openqa.selenium.WebDriver;
<span class="hljs-keyword">import</span> org.openqa.selenium.chrome.ChromeDriver;

<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">LaunchBrowser</span> </span>{
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">(String[] args)</span> </span>{
        <span class="hljs-comment">// Directly create ChromeDriver instance (Selenium 4+ handles driver management)</span>

        <span class="hljs-comment">// Set the path to the chromedriver executable, but from Selenium 4+ it's handled automatically,</span>
        <span class="hljs-comment">// so setting System.setProperty is no longer necessary unless you're using a custom setup.</span>
        <span class="hljs-comment">// System.setProperty("webdriver.chrome.driver", "C:\\path\\to\\chromedriver.exe");</span>

        <span class="hljs-comment">// Create a new instance of the Chrome driver</span>
        WebDriver driver = <span class="hljs-keyword">new</span> ChromeDriver();

        <span class="hljs-comment">// Open a website</span>
        driver.get(<span class="hljs-string">"https://www.google.com"</span>);

        <span class="hljs-comment">// Print the title of the page</span>
        System.out.println(<span class="hljs-string">"Page title is: "</span> + driver.getTitle());

        <span class="hljs-comment">// Close the browser</span>
        driver.quit();
    }
}
</code></pre>
<hr />
<h2 id="heading-explanation">📌 Explanation</h2>
<ul>
<li><p><code>System.setProperty(...)</code>: Tells Selenium where your browser driver is located.</p>
</li>
<li><p><code>new ChromeDriver()</code>: Launches the Chrome browser.</p>
</li>
<li><p><code>driver.get(...)</code>: Opens the desired URL.</p>
</li>
<li><p><code>driver.quit()</code>: Closes all browser windows opened during the session.</p>
</li>
</ul>
<hr />
<h2 id="heading-why-start-with-browser-launching">🤔 Why Start with Browser Launching?</h2>
<p>Launching the browser is the <em>"Hello World!"</em> of Selenium automation. It proves your setup is correct and helps you move on to test case automation, element interactions, and full end-to-end testing.</p>
<hr />
<h2 id="heading-next-steps">🎯 Next Steps</h2>
<p>Now that you can launch a browser:</p>
<ul>
<li>Learn to locate and interact with web elements (<code>click</code>, <code>sendKeys</code>, etc.)</li>
</ul>
<blockquote>
<p>Stay Tuned..!</p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[Myths, Facts & Magic About Programming – What’s Real and What’s Just Hype?]]></title><description><![CDATA[Let’s be honest — programming sounds like wizardry to many people. You type some strange words… and boom! A website appears, a game runs, or an app…]]></description><link>https://lets-programming.pratiks-desk.in/myths-facts-and-magic-about-programming-whats-real-and-whats-just-hype</link><guid isPermaLink="true">https://lets-programming.pratiks-desk.in/myths-facts-and-magic-about-programming-whats-real-and-whats-just-hype</guid><category><![CDATA[programming languages]]></category><category><![CDATA[computer programming, coding, software development, computer science, programming languages, compilers, interpreters, bits, bytes, variables, data types, type checking, data structures, control flow, loops, recursion, big O notation, programming paradigms, functional programming, algorithms, code editors, operating systems]]></category><dc:creator><![CDATA[Pratik J]]></dc:creator><pubDate>Thu, 10 Apr 2025 15:47:59 GMT</pubDate><content:encoded><![CDATA[<p>Let’s be honest — programming sounds like wizardry to many people.</p>
<p>You type some strange words… and boom! A website appears, a game runs, or an app launches.</p>
<p>But what’s <strong>real</strong>, what’s just <strong>hype</strong>, and what actually feels like <strong>magic</strong>? In this guide, we’ll bust the biggest myths, reveal the truths, and sprinkle in a little programming magic to inspire you.</p>
<hr />
<h2 id="heading-1-myth-you-need-to-be-a-math-genius-to-learn-programming"><strong>1. MYTH: You need to be a math genius to learn programming</strong></h2>
<p><strong>FACT:</strong> Not at all!</p>
<p>Sure, some programming involves numbers, but many successful programmers are not math wizards.</p>
<p><strong>What you really need:</strong></p>
<ul>
<li><p>Logical thinking</p>
</li>
<li><p>Patience</p>
</li>
<li><p>Curiosity</p>
</li>
<li><p>The ability to break big problems into small steps</p>
</li>
</ul>
<blockquote>
<p>Native phrase alert: <em>“You don’t need to reinvent the wheel”</em> – You don’t need to be Einstein to get started!</p>
</blockquote>
<hr />
<h2 id="heading-2-myth-programming-is-only-for-young-people-or-techies"><strong>2. MYTH: Programming is only for young people or 'techies'</strong></h2>
<p><strong>FACT:</strong> Anyone can learn programming — at <strong>any age</strong>.</p>
<p>People start coding in their 30s, 40s, even 60s! All you need is internet access, a basic computer, and the desire to learn.</p>
<blockquote>
<p><strong>Real magic:</strong> Code doesn’t care how old you are — it only listens to logic.</p>
</blockquote>
<hr />
<h2 id="heading-3-myth-programming-is-boring-just-typing-lines-of-code-all-day"><strong>3. MYTH: Programming is boring – just typing lines of code all day</strong></h2>
<p><strong>FACT:</strong> Programming is <strong>super creative</strong>.</p>
<p>You’re building things from scratch:</p>
<ul>
<li><p>Apps</p>
</li>
<li><p>Games</p>
</li>
<li><p>Art with code</p>
</li>
<li><p>Tools to automate your life</p>
</li>
</ul>
<p>It’s like digital LEGO. You imagine it, then bring it to life line by line.</p>
<hr />
<h2 id="heading-4-myth-you-have-to-memorize-thousands-of-commands"><strong>4. MYTH: You have to memorize thousands of commands</strong></h2>
<p><strong>FACT:</strong> Even professional developers Google things every day!</p>
<p>Learning programming is not about memorizing — it’s about knowing <strong>how to think</strong> and <strong>how to find solutions</strong>.</p>
<blockquote>
<p>Common phrase: <em>“Work smarter, not harder”</em> — use documentation, forums, and tools to help you.</p>
</blockquote>
<hr />
<h2 id="heading-5-magic-automation-feels-like-having-a-superpower"><strong>5. MAGIC: Automation feels like having a superpower</strong></h2>
<p>Ever wrote code that:</p>
<ul>
<li><p>Automatically renames hundreds of files?</p>
</li>
<li><p>Sends emails while you sleep?</p>
</li>
<li><p>Fills out boring forms for you?</p>
</li>
</ul>
<p>That’s not just helpful — it’s <em>magic</em>. You feel like a tech sorcerer.</p>
<hr />
<h2 id="heading-6-myth-you-need-a-fancy-degree-to-become-a-programmer"><strong>6. MYTH: You need a fancy degree to become a programmer</strong></h2>
<p><strong>FACT:</strong> Nope!</p>
<p>Many programmers are <strong>self-taught</strong> using:</p>
<ul>
<li><p>Free websites (like FreeCodeCamp, W3Schools, YouTube)</p>
</li>
<li><p>Online courses (Coursera, Udemy)</p>
</li>
<li><p>Practice platforms (HackerRank, LeetCode, Replit)</p>
</li>
</ul>
<p>Your <strong>portfolio</strong> and <strong>skills</strong> matter more than a diploma in the real world.</p>
<hr />
<h2 id="heading-7-magic-seeing-your-first-program-run-is-unforgettable"><strong>7. MAGIC: Seeing your first program run is unforgettable</strong></h2>
<p>Remember the first time you rode a bike or cooked something yourself?</p>
<p>Writing your first program (even a simple "Hello, World") gives you a similar <em>rush of pride</em>.</p>
<pre><code class="lang-python">print(<span class="hljs-string">"Hello, World!"</span>)
</code></pre>
<p>You wrote that. The computer listened. Welcome to the coding club.</p>
<hr />
<h2 id="heading-8-myth-once-you-learn-one-language-youre-stuck-with-it"><strong>8. MYTH: Once you learn one language, you’re stuck with it</strong></h2>
<p><strong>FACT:</strong> Programming skills are <strong>transferable</strong>.</p>
<p>Learn one language (like Python), and picking up others (like JavaScript or Java) becomes easier.</p>
<p>It’s like learning one musical instrument — the basics help you try others faster.</p>
<hr />
<h2 id="heading-9-magic-code-can-change-lives-literally"><strong>9. MAGIC: Code can change lives — literally</strong></h2>
<p>From building apps that help farmers, to medical tools, to language translators — programming is used to:</p>
<ul>
<li><p>Help people</p>
</li>
<li><p>Save lives</p>
</li>
<li><p>Connect the world</p>
</li>
</ul>
<p><strong>Your code can have an impact far beyond your screen.</strong></p>
<hr />
<h2 id="heading-10-final-thoughts-embrace-the-code-my-friend"><strong>10. Final Thoughts – Embrace the Code, My Friend</strong></h2>
<p>Programming has its myths, sure. But beyond the confusion and buzzwords, there’s a world full of possibility.</p>
<p>You don’t have to be perfect, fast, or a genius. You just have to start.</p>
<blockquote>
<p>“The only way to learn to code… is to code.”</p>
</blockquote>
<hr />
<h3 id="heading-ready-to-experience-the-real-magic-of-code">Ready to experience the real magic of code?</h3>
<p>If you're curious, I'll gladly give you a fun, 10-minute mini project to try — just ask!😊</p>
]]></content:encoded></item><item><title><![CDATA[Computer Programming Fundamentals – A Beginner’s Friendly Guide]]></title><description><![CDATA[So, you’ve heard about coding and programming, and now you’re curious: What exactly is computer programming? If you're just getting started and want to…]]></description><link>https://lets-programming.pratiks-desk.in/computer-programming-fundamentals-a-beginners-friendly-guide</link><guid isPermaLink="true">https://lets-programming.pratiks-desk.in/computer-programming-fundamentals-a-beginners-friendly-guide</guid><category><![CDATA[computer programming]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Pratik J]]></dc:creator><pubDate>Thu, 10 Apr 2025 15:25:15 GMT</pubDate><content:encoded><![CDATA[<p>So, you’ve heard about coding and programming, and now you’re curious: <em>What exactly is computer programming?</em> If you're just getting started and want to understand the basics without the jargon, you’re in the right place!</p>
<ul>
<li><p>Grab a cup of tea, sit back, and let’s break it down in a simple, relaxed way.</p>
<hr />
<h2 id="heading-1-what-is-computer-programming"><strong>1. What Is Computer Programming?</strong></h2>
<p>  In plain English, <strong>computer programming</strong> is the process of <strong>giving instructions to a computer</strong> to perform a task.</p>
<p>  Imagine you’re writing a recipe for a robot cook — you need to be super clear, step-by-step:</p>
<blockquote>
<p>“Take 2 eggs, crack them, mix with flour, bake at 180°C for 30 minutes.”</p>
</blockquote>
<p>  That’s exactly what programming is — <strong>telling the computer what to do</strong>, how to do it, and in what order.</p>
<hr />
<h2 id="heading-2-why-is-programming-important"><strong>2. Why Is Programming Important?</strong></h2>
<p>  Programming is everywhere:</p>
<ul>
<li><p>Your mobile apps? Written in code.</p>
</li>
<li><p>ATM machines? Powered by programs.</p>
</li>
<li><p>Websites, games, even your smart fridge — all use programming.</p>
</li>
</ul>
</li>
</ul>
<p>    Learning programming gives you <strong>superpowers</strong> — you can build things, solve problems, and even automate boring tasks.</p>
<hr />
<h2 id="heading-3-how-does-programming-work"><strong>3. How Does Programming Work?</strong></h2>
<p>    Computers don’t understand human languages. They understand <strong>binary</strong> (0s and 1s). But don’t worry — we don’t write code in binary.</p>
<p>    We use <strong>programming languages</strong> like:</p>
<ul>
<li><p><strong>Python</strong> (simple and beginner-friendly)</p>
</li>
<li><p><strong>JavaScript</strong> (great for websites)</p>
</li>
<li><p><strong>Java</strong> (used in apps, games, and more)</p>
</li>
<li><p><strong>C/C++</strong> (used in systems and performance-heavy tasks)</p>
</li>
</ul>
<p>    These languages let us write instructions in a way both <strong>humans and computers</strong> can understand.</p>
<hr />
<h2 id="heading-4-the-building-blocks-of-programming"><strong>4. The Building Blocks of Programming</strong></h2>
<p>    Let’s look at the main elements you'll find in most programming languages:</p>
<h3 id="heading-a-variables"><strong>a. Variables</strong></h3>
<p>    Think of variables as <strong>containers</strong> that store information.</p>
<pre><code class="lang-python">    age = <span class="hljs-number">25</span>
</code></pre>
<h3 id="heading-b-data-types"><strong>b. Data Types</strong></h3>
<p>    Different kinds of information:</p>
<ul>
<li><p>Numbers: <code>10</code>, <code>3.14</code></p>
</li>
<li><p>Text: <code>"Hello"</code></p>
</li>
<li><p>True/False: <code>True</code>, <code>False</code></p>
</li>
</ul>
<h3 id="heading-c-operators"><strong>c. Operators</strong></h3>
<p>    Used to do math and compare things.</p>
<pre><code class="lang-python">    total = <span class="hljs-number">5</span> + <span class="hljs-number">3</span>
</code></pre>
<h3 id="heading-d-conditional-statements"><strong>d. Conditional Statements</strong></h3>
<p>    Let the program make decisions:</p>
<pre><code class="lang-python">    <span class="hljs-keyword">if</span> age &gt;= <span class="hljs-number">18</span>:
        print(<span class="hljs-string">"You can vote!"</span>)
</code></pre>
<h3 id="heading-e-loops"><strong>e. Loops</strong></h3>
<p>    Do something <strong>repeatedly</strong>.</p>
<pre><code class="lang-python">    <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(<span class="hljs-number">5</span>):
        print(<span class="hljs-string">"Hello!"</span>)
</code></pre>
<h3 id="heading-f-functions"><strong>f. Functions</strong></h3>
<p>    Reusable blocks of code that <strong>do a specific task</strong>.</p>
<pre><code class="lang-python">    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">greet</span>():</span>
        print(<span class="hljs-string">"Hi there!"</span>)
</code></pre>
<hr />
<h2 id="heading-5-getting-started-your-first-program"><strong>5. Getting Started: Your First Program</strong></h2>
<p>    The classic first program is printing “Hello, World!”</p>
<h3 id="heading-in-python"><strong>In Python:</strong></h3>
<pre><code class="lang-python">    print(<span class="hljs-string">"Hello, World!"</span>)
</code></pre>
<p>    That’s it! You've just written your first line of code.</p>
<hr />
<h2 id="heading-6-how-to-practice-programming"><strong>6. How to Practice Programming</strong></h2>
<p>    Start small. Here’s how:</p>
<ul>
<li><p>Use websites like <a target="_blank" href="https://replit.com">replit.com</a>, <a target="_blank" href="https://w3schools.com">w3schools.com</a>, or <a target="_blank" href="https://code.org">code.org</a></p>
</li>
<li><p>Build small projects: A calculator, a to-do list, or a simple game</p>
</li>
<li><p>Break problems into tiny steps (like Lego pieces!)</p>
</li>
</ul>
<blockquote>
<p><strong>Pro Tip:</strong> Don’t memorize — understand. Programming is like solving puzzles, not like cramming for a test.</p>
</blockquote>
<hr />
<h2 id="heading-7-programming-mindset-think-like-a-problem-solver"><strong>7. Programming Mindset: Think Like a Problem Solver</strong></h2>
<p>    Programming is not just about code — it’s about <strong>thinking logically</strong>, <strong>being patient</strong>, and <strong>not giving up</strong> when things don’t work (which they won’t... at first!).</p>
<p>    Try this phrase:</p>
<blockquote>
<p>“If at first you don’t succeed, try debugging it again.”</p>
</blockquote>
<p>    It’s very common for even expert developers to spend hours fixing one little bug. It’s normal — and part of the fun!</p>
<hr />
<h2 id="heading-8-real-world-uses-of-programming"><strong>8. Real World Uses of Programming</strong></h2>
<p>    You can build or work on:</p>
<ul>
<li><p>Websites and mobile apps</p>
</li>
<li><p>Automation scripts to save time</p>
</li>
<li><p>Games and graphics</p>
</li>
<li><p>Data analysis and machine learning</p>
</li>
<li><p>Robotics and hardware control</p>
</li>
</ul>
<hr />
<h2 id="heading-9-final-thoughts-start-your-coding-journey-today"><strong>9. Final Thoughts – Start Your Coding Journey Today</strong></h2>
<p>    You don’t need to be a genius to code. You just need:</p>
<ul>
<li><p>Curiosity</p>
</li>
<li><p>A little time daily</p>
</li>
<li><p>A habit of trying, failing, and trying again</p>
</li>
</ul>
<p>    And remember:</p>
<blockquote>
<p>“Every expert was once a beginner.”</p>
</blockquote>
<p>    Your journey might start with one line of code — but it could lead to building your own app, landing a great job, or just having fun solving problems.</p>
<hr />
]]></content:encoded></item><item><title><![CDATA[Introduction to TestNG Framework]]></title><description><![CDATA[TestNG is a testing framework for Java mainly used for automation testing. It is similar to Junit but has more features like annotations, parallel…]]></description><link>https://lets-programming.pratiks-desk.in/introduction-to-testng-framework</link><guid isPermaLink="true">https://lets-programming.pratiks-desk.in/introduction-to-testng-framework</guid><category><![CDATA[testng]]></category><category><![CDATA[testng annotations]]></category><category><![CDATA[annotations]]></category><category><![CDATA[automation testing ]]></category><category><![CDATA[selenium]]></category><dc:creator><![CDATA[Pratik J]]></dc:creator><pubDate>Fri, 14 Mar 2025 05:52:08 GMT</pubDate><content:encoded><![CDATA[<p>TestNG is a <strong>testing framework</strong> for Java mainly used for automation testing. It is similar to Junit but has more features like annotations, parallel execution&amp; grouping tests.</p>
<p>It's used for running tests, generating reports, and organizing test execution. TestNG stands for <strong>Test Next Generation</strong>, and it’s widely used in <strong>unit testing</strong>, <strong>integration testing</strong>, and <strong>end-to-end testing</strong>.</p>
<h3 id="heading-key-features-of-testng">Key Features of TestNG:</h3>
<ol>
<li><p><strong>Annotations</strong>: Annotations are special markers with ‘@’ used before methods to control test execution. (i.e. Which method runs first and which method run at last etc.) .These annotations are more flexible than JUnit’s.</p>
<ul>
<li><p><code>@Test</code>: Marks a method as a test method.</p>
</li>
<li><p><code>@BeforeSuite</code>, <code>@AfterSuite</code>: Methods that run before and after the entire suite.</p>
</li>
<li><p><code>@BeforeTest</code>, <code>@AfterTest</code>: Methods that run before and after each test tag.</p>
</li>
<li><p><code>@BeforeMethod</code>, <code>@AfterMethod</code>: Methods that run before and after each test method.</p>
</li>
<li><p><code>@DataProvider</code>: Used for providing test data to methods.</p>
</li>
</ul>
</li>
<li><p><strong>Parallel Test Execution</strong>: TestNG allows you to run tests in parallel, which helps speed up the testing process, especially when running large test suites.</p>
</li>
<li><p><strong>Group Testing</strong>: With TestNG, you can group tests together and execute them as a set, or include/exclude certain groups based on the test case.</p>
</li>
<li><p><strong>Test Configuration</strong>: It provides configurations such as retrying failed tests, specifying the order of test execution, and handling test dependencies.</p>
</li>
<li><p><strong>XML Configuration</strong>: TestNG uses an XML file (<code>testng.xml</code>) for running tests. This XML configuration provides a lot of flexibility, such as running tests in a specific order, setting up parallel execution, and grouping tests.</p>
</li>
<li><p><strong>Reporting</strong>: TestNG generates detailed reports after running tests, which include pass/fail results, test duration, etc. These reports help you analyze test results quickly.</p>
</li>
<li><p><strong>Assertions</strong>: TestNG supports <strong>assertions</strong> that you can use in your test methods to verify the output of your tests. For example:</p>
<ul>
<li><code>assertTrue()</code>, <code>assertFalse()</code>, <code>assertEquals()</code>, etc.</li>
</ul>
</li>
<li><p><strong>Test Dependencies</strong>: TestNG supports specifying dependencies between tests. This is useful when a test depends on another test to pass before it runs.</p>
</li>
</ol>
<h3 id="heading-benefits-of-using-testng">Benefits of Using TestNG:</h3>
<ul>
<li><p><strong>Flexibility</strong> in test execution (parallel execution, grouping, etc.)</p>
</li>
<li><p>Detailed <strong>reports</strong> help with better test tracking and debugging.</p>
</li>
<li><p>Powerful <strong>annotations</strong> make test configuration easier.</p>
</li>
<li><p>Easy integration with build tools like <strong>Maven</strong> and <strong>Gradle</strong>.</p>
</li>
<li><p>Can be integrated with <strong>Selenium</strong> for automating web application tests.</p>
</li>
</ul>
<h3 id="heading-why-use-testng">Why Use TestNG?</h3>
<ul>
<li><p><strong>Simple to Use</strong>: TestNG has easy-to-understand annotations and provides a straightforward way to organize tests.</p>
</li>
<li><p><strong>Advanced Features</strong>: It supports advanced features such as parallel test execution, test configuration, and dependency management, which is useful for larger projects.</p>
</li>
<li><p><strong>Integration</strong>: TestNG integrates well with build tools like <strong>Maven</strong> and <strong>Gradle</strong>, as well as continuous integration tools like <strong>Jenkins</strong>.</p>
</li>
<li><p><strong>Flexible Reporting</strong>: The detailed reports help you easily track which tests passed, failed, or were skipped, and provide logs for troubleshooting.</p>
</li>
</ul>
<h3 id="heading-example-of-how-it-works">Example of How It Works:</h3>
<ul>
<li><p>You can write a test in a Java method and annotate it with <code>@Test</code>. This tells TestNG that this method is a test to be run.</p>
</li>
<li><p>TestNG will run your test, check the results, and give you a report showing if your test passed or failed.</p>
</li>
</ul>
<h3 id="heading-important-testng-annotations">Important TestNG Annotations:</h3>
<ul>
<li><p><code>@Test</code>: Marks a method as a test method.</p>
</li>
<li><p><code>@BeforeMethod</code>: Runs before each test method.</p>
</li>
<li><p><code>@AfterMethod</code>: Runs after each test method.</p>
</li>
<li><p><code>@BeforeClass</code>: Runs once before the first method in the class.</p>
</li>
<li><p><code>@AfterClass</code>: Runs once after the last method in the class.</p>
</li>
<li><p><code>@BeforeSuite</code>: Runs once before all test methods in the suite.</p>
</li>
<li><p><code>@AfterSuite</code>: Runs once after all test methods in the suite.</p>
</li>
<li><p><code>@DataProvider</code>: Provides a method with multiple sets of data to test with.</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Java for beginners]]></title><description><![CDATA[Java is a versatile, powerful, and widely-used programming language. Its combination of object-oriented principles, portability, and strong ecosystem makes…]]></description><link>https://lets-programming.pratiks-desk.in/java-for-beginners</link><guid isPermaLink="true">https://lets-programming.pratiks-desk.in/java-for-beginners</guid><category><![CDATA[Java]]></category><category><![CDATA[beginner]]></category><category><![CDATA[OOPS]]></category><category><![CDATA[programming languages]]></category><category><![CDATA[Core Java]]></category><category><![CDATA[java for beginners]]></category><dc:creator><![CDATA[Pratik J]]></dc:creator><pubDate>Fri, 14 Mar 2025 00:47:48 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-lets-take-a-look-at-java"><mark>Let's take a look at Java</mark></h2>
<ul>
<li><p>Java is a versatile, powerful, and widely-used programming language. Its combination of object-oriented principles, portability, and strong ecosystem makes it a preferred choice for developers working on a wide range of applications.</p>
</li>
<li><p>Whether you're building web applications, mobile apps, or enterprise-level software, Java continues to be an excellent choice due to its stability, performance, and large community of developers.</p>
</li>
</ul>
<blockquote>
<p><strong>Here are the steps to install Java on your system.</strong></p>
</blockquote>
<h3 id="heading-1-what-is-java"><strong>1. What is Java?</strong></h3>
<p>Java is a programming language used to create software, apps, and websites. It is <strong>easy to learn</strong> for beginners and can be run on any computer or device.</p>
<ul>
<li><p><strong>Write Once, Run Anywhere</strong>: This means that you can write a program in Java, and it can run on any computer (like Windows, Mac, etc.) without any changes.</p>
</li>
<li><p><strong>Object-Oriented</strong>: Java organizes programs into <strong>objects</strong> (things that have properties and actions) and <strong>classes</strong> (blueprints for creating objects).</p>
</li>
</ul>
<h3 id="heading-2-core-concepts-of-java"><strong>2. Core Concepts of Java</strong></h3>
<p>Let’s dive deeper into the basic building blocks of Java.</p>
<h4 id="heading-21-variables">2.1 <strong>Variables</strong></h4>
<p>A <strong>variable</strong> is like a box where you store data. Each box has a <strong>type</strong>, which tells the program what kind of data it holds. For example, numbers go into an <strong>integer</strong> type box, and text goes into a <strong>string</strong> type box.</p>
<ul>
<li><p><strong>Example Types</strong>:</p>
<ul>
<li><p><strong>int</strong>: Used for whole numbers (like 10, 20, 50).</p>
</li>
<li><p><strong>double</strong>: Used for numbers with decimals (like 3.14, 20.5).</p>
</li>
<li><p><strong>String</strong>: Used for text (like "Hello", "Java").</p>
</li>
<li><p><strong>boolean</strong>: Used for true/false values (like true, false).</p>
</li>
</ul>
</li>
</ul>
<p>You <strong>declare</strong> a variable by naming it and specifying its type.</p>
<h4 id="heading-22-classes-and-objects">2.2 <strong>Classes and Objects</strong></h4>
<ul>
<li><p>A <strong>class</strong> is like a blueprint. It tells you what an object will be like and what it will do.</p>
</li>
<li><p>An <strong>object</strong> is a specific instance of a class, created from the class blueprint. For example, the class could be "Car," and an object would be a red car or a blue car.</p>
</li>
</ul>
<h4 id="heading-key-ideas">Key Ideas:</h4>
<ul>
<li><p><strong>Class</strong> = Blueprint</p>
</li>
<li><p><strong>Object</strong> = Instance of the class (a real thing)</p>
</li>
</ul>
<p>For example, if you have a <strong>Car</strong> class, it might have properties like <strong>color</strong> and <strong>speed</strong>, and actions like <strong>drive</strong> or <strong>stop</strong>. From this blueprint, you can create different <strong>Car objects</strong>: a red car, a blue car, etc.</p>
<h4 id="heading-23-methods">2.3 <strong>Methods</strong></h4>
<p><strong>Methods</strong> are instructions inside a class that tell objects what to do. Think of a method like a task or action.</p>
<ul>
<li><p>A <strong>method</strong> could be something like <strong>drive</strong>, which makes a car move, or <strong>accelerate</strong>, which increases the speed of the car.</p>
</li>
<li><p>You call a method to perform an action. For example, to make the car <strong>drive</strong>, you call the <strong>drive</strong> method.</p>
</li>
</ul>
<h3 id="heading-3-java-program-structure-what-it-looks-like"><strong>3. Java Program Structure (What it looks like)</strong></h3>
<p>Every Java program consists of <strong>classes</strong>, <strong>methods</strong>, and <strong>statements</strong> (commands for the program to follow). Let’s break it down.</p>
<ol>
<li><p><strong>Class</strong>: You start by defining a class. Every program has at least one class.</p>
</li>
<li><p><strong>Main Method</strong>: Inside a class, there is a special method called the <strong>main method</strong>. This is the entry point of the program—where Java starts executing your code.</p>
</li>
<li><p><strong>Statements</strong>: Inside the methods, you write statements to define what the program does. For example, telling the program to print something on the screen or to perform calculations.</p>
</li>
</ol>
<h3 id="heading-4-why-use-java"><strong>4. Why Use Java?</strong></h3>
<p>Because it’s:-</p>
<ul>
<li><p><strong>Simple to Learn</strong>: It has easy-to-understand syntax (rules for writing code).</p>
</li>
<li><p><strong>Cross-Platform</strong>: Java programs can run on any device.</p>
</li>
<li><p><strong>Large Community</strong>: There are plenty of resources to help you learn.</p>
</li>
<li><p><strong>Widely Used</strong>: Java is used for building big software systems, mobile apps, and websites.</p>
</li>
</ul>
<h3 id="heading-5-basic-flow-in-java"><strong>5. Basic Flow in Java</strong></h3>
<ol>
<li><p><strong>Create a Class</strong>: Think of it as a template. You define what the object will have (properties like color, speed) and what it can do (like moving).</p>
</li>
<li><p><strong>Create an Object</strong>: From the class, you make specific objects (like a red car or a blue car).</p>
</li>
<li><p><strong>Call Methods</strong>: Once you have an object, you can call its methods to perform actions (like start the car).</p>
</li>
</ol>
<h3 id="heading-6-main-things-to-remember"><strong>6. Main Things to Remember</strong>:</h3>
<ul>
<li><p><strong>Variables</strong>: Store information like numbers or text.</p>
</li>
<li><p><strong>Classes</strong>: Define how objects work.</p>
</li>
<li><p><strong>Methods</strong>: Set of instructions that objects can perform.</p>
</li>
<li><p><strong>Objects</strong>: Instances of a class that can have properties and actions.</p>
</li>
</ul>
<h3 id="heading-7-how-control-works-in-java"><strong>7. How Control Works in Java</strong></h3>
<p>In Java, you control the flow of your program using <strong>decisions</strong> and <strong>loops</strong>. This helps your program decide what to do at different points.</p>
<p>7.1 <strong>If-Else Statements</strong></p>
<p>These are used when you want your program to make a decision, like:</p>
<ul>
<li><p><strong>If something is true</strong>, do this.</p>
</li>
<li><p><strong>Else</strong>, do that.</p>
</li>
</ul>
<p>For example:</p>
<ul>
<li><p>If the temperature is more than 30°C, wear shorts.</p>
</li>
<li><p>Else, wear a jacket.</p>
</li>
</ul>
<h4 id="heading-72-loops">7.2 <strong>Loops</strong></h4>
<p>A loop allows your program to repeat something multiple times without having to write the same code again. There are two main types:</p>
<ul>
<li><p><strong>For Loop</strong>: Repeat a task a set number of times.</p>
</li>
<li><p><strong>While Loop</strong>: Repeat a task as long as a condition is true.</p>
</li>
</ul>
<p>Example: If you want to print numbers from 1 to 5, you can use a loop to repeat the action of printing each number.</p>
<h3 id="heading-8-how-does-java-work">8. How Does Java Work?</h3>
<ol>
<li><p><strong>Write the Code</strong>:</p>
<ul>
<li>You write the Java code using a text editor or a tool called an <strong>IDE</strong> (Integrated Development Environment). This is where you type the instructions (called "code") for your program.</li>
</ul>
</li>
<li><p><strong>Compile the Code</strong>:</p>
<ul>
<li>Once you write your code, it gets <strong>compiled</strong> into <strong>bytecode</strong>. This is done by a special program called the <strong>Java Compiler</strong>. The bytecode is not understood by humans but can be run by the JVM.</li>
</ul>
</li>
<li><p><strong>Run the Program</strong>:</p>
<ul>
<li>After compiling, the bytecode is run on any computer with a <strong>JVM</strong>. The JVM translates the bytecode into instructions that your computer can understand and execute.</li>
</ul>
</li>
</ol>
<h3 id="heading-9-java-development-components">9. <strong>Java Development Components</strong></h3>
<ol>
<li><p><strong>JDK (Java Development Kit)</strong>:</p>
<ul>
<li>The <strong>JDK</strong> is the complete package needed for developing Java applications. It includes the <strong>Java Compiler</strong>, <strong>JVM</strong>, libraries, and other tools for development.</li>
</ul>
</li>
<li><p><strong>JVM (Java Virtual Machine)</strong>:</p>
<ul>
<li>The <strong>JVM</strong> is the engine that runs Java applications. It converts the compiled Java code (bytecode) into machine code that your computer can understand.</li>
</ul>
</li>
<li><p><strong>JRE (Java Runtime Environment)</strong>:</p>
<ul>
<li>The <strong>JRE</strong> includes the <strong>JVM</strong> and libraries required to run Java programs. It doesn’t include tools for development like the JDK.</li>
</ul>
</li>
</ol>
<h3 id="heading-10-object-oriented-programming-oop-in-detail"><strong>10. Object-Oriented Programming (OOP) in Detail</strong></h3>
<p>Java is an <strong>object-oriented</strong> programming language. This means everything is based around <strong>objects</strong> and <strong>classes</strong>. Here’s how it works:</p>
<h4 id="heading-101-encapsulation">10.1 <strong>Encapsulation</strong></h4>
<p>Encapsulation means packing data and methods(like functions) in single unit (like a capsule). In other words Hiding the details of how data is stored and only showing necessary parts to interact with it.</p>
<p>And Only special methods can open the box to get or change the data.</p>
<p>So, encapsulation is nothing but <strong>keeping data safe</strong> inside an object and providing methods (functions) to access that data. You don’t directly change the data inside the object; you do it through methods.</p>
<p>For example, a <strong>Car</strong> object has a property like <strong>speed</strong>. You can’t directly change <strong>speed</strong> from outside, but you can use a method like <strong>accelerate</strong> to safely increase the speed.</p>
<h4 id="heading-102-inheritance">10.2 <strong>Inheritance</strong></h4>
<p>Inheritance is when one class (child class) can inherit (hold/takes) properties and behaviors (methods) from another class (parent class).</p>
<p><strong>Why do we use it?</strong>: To avoid repeating code and reuse what’s already there.</p>
<p>For example:</p>
<ul>
<li><p>You can have a <strong>Vehicle</strong> class with common properties like <strong>speed</strong> and <strong>color</strong>.</p>
</li>
<li><p>A <strong>Car</strong> class and a <strong>Truck</strong> class can inherit from <strong>Vehicle</strong>. So, both Car and Truck will have properties like <strong>speed</strong> and <strong>color</strong>, but they can also have their own unique behaviors (like <strong>truckLoad()</strong> for the truck).</p>
</li>
</ul>
<h4 id="heading-103-polymorphism">10.3 <strong>Polymorphism</strong></h4>
<p>Polymorphism allows the same method to behave differently based on the object that is calling it. For example:</p>
<ul>
<li><p>A <strong>Car</strong> object and a <strong>Truck</strong> object might both have a <strong>honk()</strong> method, but they might make different sounds when the method is called.</p>
</li>
<li><p><strong>Example</strong>: A car <strong>honks</strong> with "Beep beep!", and a <strong>Truck</strong> honks with "HONK HONK!" but both use the same <strong><em>honk()</em></strong> method.</p>
</li>
</ul>
<h3 id="heading-11-error-handling-what-happens-when-something-goes-wrong"><strong>11. Error Handling (What Happens When Something Goes Wrong?)</strong></h3>
<p>In any program, things can go wrong. <strong>Error handling</strong> helps the program continue running even when something unexpected happens.</p>
<p>In Java, you can use <strong>try-catch</strong> blocks to handle errors. This means:</p>
<ul>
<li><p>You <strong>try</strong> to run a piece of code.</p>
</li>
<li><p>If there’s an error, you can <strong>catch</strong> it and show a message, instead of letting the program crash.</p>
</li>
</ul>
<blockquote>
<p><strong>"That’s all for now." Thank you.!</strong></p>
</blockquote>
<hr />
]]></content:encoded></item></channel></rss>