0% found this document useful (0 votes)
24 views1 page

Java

The document discusses the main method in Java, which is static and can receive command line arguments as a String array. It also covers correct usage of System.out.println() to print variables and strings, and explains that the + operator appends a number to a string. Additionally, it lists the primary data types in Java including integer, floating point, character, and boolean, and describes automatic and explicit type conversion between types.

Uploaded by

jashmine15
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views1 page

Java

The document discusses the main method in Java, which is static and can receive command line arguments as a String array. It also covers correct usage of System.out.println() to print variables and strings, and explains that the + operator appends a number to a string. Additionally, it lists the primary data types in Java including integer, floating point, character, and boolean, and describes automatic and explicit type conversion between types.

Uploaded by

jashmine15
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

JAVA

Public static void main(String args[])


Static => called without having to instantiate particular instance of the object.
String args[] => to receive command line arguments.
System.out.println("This is num: " + num); -> correct
System.out.println("This is num: " num); -> wrong
System.out.println(num); -> correct
System.out.println(+num); -> correct

+ appends the num to the string.
Using + we can append n no of string in a single statement.
DATA TYPE:

INTEGER=> short,int,long,byte
FLOATING POINT NUMBER => float(32 bit),double(64 bit)
CHAR(8 bit)
BOOLEAN(o or 1)
Automatic type conversion => destination type is larger than the source type.
Explicit type conversion => (target-type)value

You might also like