0% found this document useful (0 votes)
3 views8 pages

PHP Learning Template: Basics to Intermediate

This document serves as a learning template for students to summarize their knowledge of programming languages, specifically focusing on Java. It outlines a step-by-step approach for students to independently document their understanding of various programming concepts, including syntax, data types, control structures, and exception handling. The template encourages personal input and comprehension, while providing a structured format for learning and assessment.

Uploaded by

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

PHP Learning Template: Basics to Intermediate

This document serves as a learning template for students to summarize their knowledge of programming languages, specifically focusing on Java. It outlines a step-by-step approach for students to independently document their understanding of various programming concepts, including syntax, data types, control structures, and exception handling. The template encourages personal input and comprehension, while providing a structured format for learning and assessment.

Uploaded by

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

Template

for
learning
Phase 1: Summarize your learning about the programming language that you already know
another
Read this first
Ifprogrammi
you REALLY want to learn then this phase must be done independently by each student because everyone’s level of understanding,
background knowledge and expertise in your current programming language differs.

Right hand column of this document is partially filled, to help you know what is expected to be written here.

Copy-pasting this column is useless for you unless you know it well and you have to write very large text.

Remove the already written text in the right-hand column before filling the cell by yourself.
PHP Learning Template: Ver. 2.0 (Basics to Intermediate) | badarsami@gmail
Your answers must be precise in your own words and must not leave any important point about that concept.

You can take help from the source (book, tutorial, etc.) that you have used to learn your older language.

STEP 1: Read the question about a concept from the left column and write a comprehensive
answer in the left column against the question.
STEP 2: Submit this document to Google Classroom
STEP 3: Ask someone experienced in your target language for some good books.
STEP 4: Get those books (printed or electronic)
STEP 5: Have a quick scan of the suggested books and choose only one book. If you feel
that this is not sufficient then you can choose another from the suggested
books. (Max. is three books. MUST NOT SELECT MORE THAN 3)
STEP 6: Start phase 2 of your learning (Next phase will be suggested by taking into
consideration your progress and quality of answers.
Page 1 of 5
Concept Java
1. Some basics
2. Overall Program Structure import <library-name>

class <class-name>
{
int main(void)
{
.
.
}
}
This source code must be saved with the same name as of class and with “java” as
extension
3. How to comment/uncomment // single line comments
program lines /* multi-line comments Start
.
.

PHP Learning Template: Ver. 2.0 (Basics to Intermediate) | badarsami@gmail


4. Supported Data Types
*/ multi-line comments end
byte
short
int
long
float
double
char
boolean

5. How to Define a Variable <Datatype> <variable-name>;


6. Assigning values to variables <Var-name> = <variable|value|expression>;
7. ---and --- typecasting <Var-name> = [(<data-type>)] <variable|value|expression>;
8. Mathematical Expression +
Writing/Evaluation Rules -
 Available mathematical /
operators *
 operators precedence %
 order of evaluation of
expression +=
Page 1 of 5
-=
*=
/=
%=

++
--
9. relational expressions <Value/variable/expression> <rel-operator> <variable/value/expression>

>
<
>=
<=
==
!=

ternary operator
int smaller = x < y ? x : y;
syntax ==>test ? trueresult : falseresult

10.
PHP Learning Template:!&&Ver. 2.0 (Basics to Intermediate) | badarsami@gmail
logical Expression
Writing/Evaluation Rules and
their combination ||
11. Bit operators &
!
^
<<
>>
>>>
12. Overall precedence of 1 ++ −− ! ~
mathematical, relational and 2 * / %
logical operators 3 + −
4 << >> >>>
5 < <= > >=
6 == !=
7 &
8 ^
9 |
10 &&
11 ||
Page 1 of 5
12 = op=

13. String handling Strings are handled using the objects of “String” class
 Define String <variable-name>
 Initialize String <varibale-name> = <String-literal>
14. Statement separators ;
15. Input Statements import [Link];
Scanner read;
read= new Scanner([Link]);

Steps:
1) import [Link];
2) Define an object of Scanner class and initialize it with “[Link]” as
parameter to take input from keyboard
3) Call appropriate function to take an input value through the keyboard from
user. Its Syntax is as follows;

<variable-name> = <object-name>.next<dataType>();
Where <dataType> may be one of these {BigDecimal, BigInteger, BigFloat, …}

16. PHP Learning


Output Template:[Link](<value>
Statements Ver. 2.0 (Basics to Intermediate)
<functionCall([arguments])>)
| badarsami@gmail
| <variable>| <expression> |

[Link](<value> | <variable>| <expression> | <functionCall([arguments])>)

[Link](“<format-string>” , <values> | <variables>| <expressions> |


<functionsCalls([arguments])>)

[Link] (" 1 2 3 4 5 6\n");


[Link] ("123456789012345678901234567890123456789012345678901234567890\n");
[Link] ("a\tbc\tdef\tghij\tklmno\tpqrstu\tvwxyz123\n");
[Link] ("abcdefghijklmnop\topqrstuvwxyz\n");

17. Available Library import [Link];


Functions
[Link](1); //1 means 1 radian
[Link]()
.tan()
Page 1 of 5
.log()
.log10()
.sqrt()
.pow(base, radix)
.exp()
.asin()
.acos()
.atan()
.cosh()
.sinh()
.tanh()
[Link]
18. Selection Statements if (condition) statement;
if (condition) {statements;}
if (condition) statement; else statement;

switch (expression)
{
case1: statement; break;
case2: statement;
PHP Learning Template: Ver. 2.0 (Basics to Intermediate) | badarsami@gmail
default:
}
expressions and case values must be of primitive data types (primitive types are
those which are castable to int, which are byte, char, short, or int))
19. Iterative Statements for (statement-1; statement-2, statement-3) { body-of-for-loop}

while (condition) { body-of-while-loop}

do-while
20. Arrays Single dimensional arrays
 Declare
 Create example: int[] a = new int[6];
 Initialize
 use <data-type>[] <array-name> = new <data-type> [ array-size ];

<data-type> <array-name>[] = {<value-1>, <value-2>, … <value-n]}


A[3] = 4096, <array-name>[index] = <value>
A[3], <array-name>[index]

Multidimensional Arrays
Page 1 of 5
example: int[][] a ={{-1, -3, -9} , {5, 3, 9, 1, 12, 4} };

<data-type> <array-name>[][] = new <data-type> [ number-of-rows ][ number-of-


columns ];
<data-type> <array-name>[][] = {
{<value-1>, <value-2>, … <value-n]},
{<value-1>, <value-2>, … <value-n]}
}

A[3][7] = 4096, <array-name>[row-index][column-index] = <value>


A[4][2], <array-name>[row-index][column-index]

PHP Learning Template: Ver. 2.0 (Basics to Intermediate) | badarsami@gmail



21. Modularization/Functions <access_modifier> <return_type> <method_name>(<parameter_list>) {
// Method body
// Code to execute
}
static int plusMethodInt(int x, int y) {
return x + y;}
static double plusMethodDouble(double x, double y) {
return x + y;}
public static void main(String[] args) {
int myNum1 = plusMethodInt(8, 5);
double myNum2 = plusMethodDouble(4.3, 6.26);
[Link]("int: " + myNum1);
[Link]("double: " + myNum2);}

Page 1 of 5
static int plusMethod(int x, int y) {
return x + y;}
static double plusMethod(double x, double y) {
return x + y;}
public static void main(String[] args) {
int myNum1 = plusMethod(8, 5);
double myNum2 = plusMethod(4.3, 6.26);
[Link]("int: " + myNum1);
[Link]("double: " + myNum2);}

22. Passing Values from /to


Modules and Functions
23. How arrays are passed to FileReader file = null;
and from modules/functions try {
file = new FileReader("[Link]");
}
catch(FileNotFoundException e) {
[Link]([Link]());
PHP Learning Template: Ver. 2.0 (Basics to Intermediate) | badarsami@gmail
}
finally {
if (file != null) {
try { [Link](); }
catch(IOException e) {}
}
}
24. External File/Data are to be handled in the same way. Each exception is separated with a vertical bar (|) in the catch clause:
Handling
catch(IOException | SQLException e) {
// Handle exception
}
Finally block: As the last clause in a try-catch statement, a finally block can be added. This block is used to clean up resources
allocated in the try block and will always execute whether or not there’s an exception. In this example, the file opened in the try
block should be closed, but only if it was successfully opened. To be able to access the FileReader object from the finally clause, it
must be declared outside of the try block. Additionally, because the close method can also throw an exception, the method needs to
be surrounded with another try-catch block. Keep in mind that if you forget to close a resource object, Java’s garbage collector will
eventually close the resource for you, but closing it yourself is good programming practice:
25. Support for User Defined

Page 1 of 5
Data types
26. Integration with Operating Not covered in Java
System
27. Recursion Already Done in Java
28. Graphics Not covered in Java
29. Exception handling Exception handling basics introduced with file handling example
30. OOP ????statred today 10-July-2025????
31. Using existing class [Link]

PHP Learning Template: Ver. 2.0 (Basics to Intermediate) | badarsami@gmail

Page 1 of 5

You might also like