Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
20 views

Java Fundamentals Part-2

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Java Fundamentals Part-2

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Java By Venkatesh Mansani Naresh i Technologies

Java Fundamentals
Operations on data:
1) (byte, short, int, char) + (byte, short, int, char) => int
2) (byte, short, int, long, char) + long => long
3) (byte, short, int, long, float, char) + float => float
4) (byte, short, int, long, float, double, char) + double => double
Note: Operations cannot be performed on booleantypes.

Declaration rules to a source file(.java file):


1) A source file can have only one public class.
2) A source file can have any number of non public classes.
3) If the source file contains public class then file name must match with
public class name.
4) If the source file does not contain public class then no naming restrictions
to a public class name.

Java Program Structure:


class Demo
{
public static void main(String args[])
{
System.out.println(“Welcome to Java”);
}
}
In the above example String & System classes are the part of java.lang package.
java.lang package is a default package and it is implicitly imported in every java
program.

Compilation:

Java By Venkatesh Mansani Naresh i Technologies


Java By Venkatesh Mansani Naresh i Technologies

C:\>javac Demo.java
The Java compiler generates .class file for every class in a source file.

Execution:
C:\>java Demo
A class that contains main() method only can be used to execute the program.
javac& java are called jdk tools. All jdk tools are the part of bin folder in JDK.
JDK stands for Java Development Kit. It is called as Java Software. Latest version of
JDK is 15.

Download & Install JDK:


To download JDK, type the following url in address bar in a browser window.
https://www.oracle.com/in/java/technologies/javase-downloads.html
Click on JDK Download hyper link, scoll down, click on jdk-15.0.1_windows-
x64_bin.exe hyper link for windows 64 bit operating system.
Accept license agreement check box & click on download button.
Note: JDK 15 not available for windows 32 bit operating system.
After downloading double click on downloaded file to install.

Path Setting:
Right click on This PC icon, click on Properties menu item, click on Advanced
System Settings, click on Environment Variables button, click on New button
under user variables type Variable Name is path & type Variable Value is
C:\Program Files\Java\jdk-15\bin; Click on Ok button.
If the path variable already exists then select the path variable, click on edit
button, append the path C:\Program Files\Java\jdk-15\bin;
Note: Before setting the path check jdk folder name in Java folder.

Java By Venkatesh Mansani Naresh i Technologies

You might also like