Home » Posts tagged "Learn Fundamentals of Java" (Page 4)

Learn Fundamentals of Java Programming “Control Flow in Java Programming ” Lesson 7

Control Flow Recall, that a program is nothing but a sequence of instructions. Java executes the instructions in sequential order, that is, one after the other. However, sometimes you might want to execute an instruction only if a condition holds true. Or you may want to execute a set of instructions repeatedly until a condition is met. Java provides selection structures for the former and repetition structures for the latter. Related...
Continue reading »

Learn Fundamentals of Java Programming “Operators in Java Programming ” Lesson 6

Operators Operators are special symbols in a programming language and perform certain specific operations. You have already seen two operator * and /. Table 2 lists the Java Arithmetic operators, Table 3 lists the Relational operators, Table 4 lists the Assignment operators, and Table 5 lists the Logical operators available in Java. Java also provides Bitwise operators which are beyond the scope of this text. Related posts: No related posts.
Continue reading »

Learn Fundamentals of Java Programming “String Variables in Java Programming ” Lesson 5

String Variables In the Percentage Calculator program of the previous section, we used variables to store numeric data. Quite often we want variables to store textual data, for example, the name of a student. A variable of the primitive data type char can be used to store a single character. To assign a value to a char variable we enclose the character between single quotes. char middle_name = ‘M’; To store...
Continue reading »

Learn Fundamentals of Java Programming “Primitive Data Types in Java Programming ” Lesson 4

Primitive Data Types Besides the two Java data types (int, double) that you have seen in the percentage calculator program, we can use six more data types. In all, Java supports eight primitive data types as in Table 1. STYLE TIP – Variable Names 1. Variable names can begin with either an alphabetic character, an underscore (_), or a dollar sign ($). However, convention is to begin a variable name with...
Continue reading »

Learn Fundamentals of Java Programming “Data Types and Variables in Java Programming ” Lesson 3

Data Types and Variables In the previous section, you learnt how to write and execute a simple Java program. This time let us write a program that does something a little more useful than just display a message. We will write a program that handles data. Given the marks obtained by a student and the total number of marks for an exam, our program will calculate the percentage obtained by the...
Continue reading »

Learn Fundamentals of Java Programming “Write Hello World Java Program” Lesson 2

Write a simple Java program that prints a Welcome Message (“Hello World”) on the screen. Since this will be your first Java program, you will first need to setup the programming environment (Refer to Appendix A for installation and starting NetBeans). Step 1: Double click the NetBeans icon on your computer to start NetBeans. Java will open the NetBeans IDE (Figure 1.1a). Step 2: All development in NetBeans is placed within...
Continue reading »

Learn Fundamentals of Java Programming “Introduction of Java” Lesson 1

  Introduction to Java Welcome to “Fundamentals of Java Programming”! In this unit, you will learn to write and execute Java programs. But before you start writing one, it is important to know what a program is. A computer program is a sequence of instructions given to the computer in order to accomplish a specific task. The instructions tell the computer what to do and how to do it. Programming is...
Continue reading »