






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Various aspects of java programming, including string concatenation and comparison, taking command line arguments, and the difference between primitives and objects. It includes example code and explanations.
Typology: Lecture notes
1 / 10
This page cannot be seen from the preview
Don't miss anything!







Web Design & Development CS-
public class StringTest { public static void main(String[] args) {
int i = 4; int j = 5;
System.out.println("Hello" + i); // will print Hello System.out.println(i + j); // will print 9
String s1 = new String (“pakistan”); String s2 = “pakistan”;
if (s1 == s2) { System.out.println(“comparing string using == operator”); }
Web Design & Development CS-
if (s1.equals( s2) ) { System.out.println(“comparing string using equal method”); } } }
Web Design & Development CS-
Output
Web Design & Development CS-
Primitives vs Objects
Stack Heap
Web Design & Development CS-
Data Type Convert String using either … byte Byte.parseByte( string^ ) new Byte( string^ ).byteValue() short Short.parseShort( string^ ) new Short( string^ ).shortValue() int Integer.parseInteger( string^ ) new Integer( string^ ).intValue() long Long.parseLong( string^ ) new Long( string^ ).longValue() float Float.parseFloat( string^ ) new Float( string^ ).floatValue() double Double.parseDouble( string^ ) new Double( string ).doubleValue()
Web Design & Development CS-
Web Design & Development CS-