Display the value of a variable w/ String Data Type
=============================
Code:
=================================
public class Test10_Pereda {
public static void main(String [] args) {
String Fname = "Sonny";
String Lname = "Pereda";
System.out.println("The value of the variable Fname: " +Fname );
System.out.println("The value of the variable Lname: " +Lname );
}
}
========================================
Sample no. 2
public class Test11_Pereda {
public static void main(String [] args) {
String Fname, Lname;
Fname = "Sonny";
Lname = "Pereda";
System.out.println (Fname);
System.out.println (Lname);
}
}
======================================
Sample no. 3
public class Test12_Pereda {
public static void main(String [] args) {
String Fname,Lname,Age,Birthdate,Address,Course,Year,Code,Title,Instructor;
Fname = "Sonny";
Lname = "Pereda";
Age = "27";
Birthdate = "July 13, 1991";
Address = "Dayao, Roxas City";
Course = "BSCS";
Year = "1A";
Code = "CC102";
Title = "Programming Language 1 (Java)";
Instructor = "Sir Clinton U. Reducto";
System.out.println("Firstname: " +Fname );
System.out.println("Lastname: " +Lname );
System.out.println("Birthdate: " +Birthdate );
System.out.println("Age: " +Age );
System.out.println("Address: " +Address );
System.out.println("Course: " +Course );
System.out.println("Year & Section: " +Year );
System.out.println("Subject Code: " +Code );
System.out.println("Subject Title: " +Title );
System.out.println("Instructor: " +Instructor );
}
}
==============================================
Walang komento:
Mag-post ng isang Komento