<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Basic java syntax | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/basic-java-syntax/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Thu, 16 Feb 2023 04:43:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>Basic Java Syntax</title>
		<link>https://studentprojects.in/software-development/java/basic-java-syntax/</link>
					<comments>https://studentprojects.in/software-development/java/basic-java-syntax/#respond</comments>
		
		<dc:creator><![CDATA[Shubhajna Rai]]></dc:creator>
		<pubDate>Sun, 19 Feb 2023 04:06:10 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Basic java syntax]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=10191</guid>

					<description><![CDATA[<p>When writing Java code, proper syntax is very crucial because even a small typo could result in an error message. The name of the class and the java file should match exactly. Additionally, every line of code must be contained within a class. A programme with different file and class names is an example. Output:</p>
<p>The post <a href="https://studentprojects.in/software-development/java/basic-java-syntax/">Basic Java Syntax</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>When writing Java code, proper syntax is very crucial because even a small typo could result in an error message.</p>



<p>The name of the class and the java file should match exactly. Additionally, every line of code must be contained within a class.</p>



<p>A programme with different file and class names is an example.</p>



<pre class="wp-block-code"><code lang="java" class="language-java">package syntax1;

public class DEtails {
    public static void main(String[] args) {
        System.out.println("Java program with diff file name and class name");
      }
}</code></pre>



<p>Output:</p>



<pre class="wp-block-code"><code lang="java" class="language-java">The public type Details must be defined in its own file.</code></pre>



<p>A programme with the same file name and class name is an example.</p>



<pre class="wp-block-code"><code lang="java" class="language-java">package syntax1;

public class Details {
    public static void main(String[] args) {
        System.out.println("Java program with same file name and class name");
      }
}</code></pre>



<p>Output:</p>



<pre class="wp-block-code"><code lang="java" class="language-java">Java program with same file name and class name</code></pre>



<p>As we can see from both cases, even the tiniest modification to the filename or class name results in an error.</p>



<p>The curly brackets include an indentation for each block of code.</p>



<p>See how each block is indented inside the parent block as an illustration.</p>



<pre class="wp-block-code"><code lang="java" class="language-java">package syntax1;

public class Details {
    public static void main(String[] args) {
        System.out.println("Java program with same file name and class name");
      }
}</code></pre>



<p>A main method, which is required for java file execution, must be present in every java file.</p>



<p>For instance, Java programming without a main method will fail.</p>



<pre class="wp-block-code"><code lang="java" class="language-java">package syntax1;

public class Details {
    System.out.println("Java program with same file name and class name");
}</code></pre>



<p>Output:</p>



<pre class="wp-block-code"><code lang="java" class="language-java">Build failed</code></pre><p>The post <a href="https://studentprojects.in/software-development/java/basic-java-syntax/">Basic Java Syntax</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/java/basic-java-syntax/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
