forked from Sonal0409/8PMJulyBatchJava-SeleniumPrograms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVariableJava.java
More file actions
106 lines (57 loc) · 2.2 KB
/
VariableJava.java
File metadata and controls
106 lines (57 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package javaPrograms8PM;
public class VariableJava {
public static void main(String[] args) {
// TODO Auto-generated method stub
// Variables and Datatypes in Java
//Whenever we are working with data on webPages which is
// fetching data from a webpage
// Send some data
// store data and print the data to verification of test cases
// Variables : they are temporary locations to store data
//Varible syntax : data types uniquevariablename = data;
// 2 types of datatypes -- primitive and non primitive
// primitive data types include: int, float , boolean and double , char, byte , short
// Non primitive data types: String , Arrays
// data types associated with the variables
// we also need to provide the type os data the variable is storing
// Data types: int : this data type is used when a variable is storing integer values
//
// Syntax:
//datatype variablename = data;
//variable declaration
int a1;
// assigning value to variables
a1=200;
String p1="200";
int a=10;
System.out.println("a");
System.out.println("hello");
System.out.println("100");
int b$=2345;
char c3='%';
String c4="How are you?%67&";
System.out.println(b$ +" "+ c3 +" " + c4); // this statement will print the value of b in console
int s4=1245677;
// String = if a variable is storing a series of character than we will use data types as String
// String always represnted in double quotes
String s1="Selenium trainign at 8 PM";
String s2="1234567";
//if a variable is storing decimal values than data type will be float or double
float dec=2.344546f;
double d1= 3.45534565465756765678;
boolean bl= true;
char ch= 'A';
char ch1= '1';
int b1=100;
// changing the value of a variable
//Assignment: declare 2 integer values,
//declare 2 string values, and print each variable value
// to call a method we need an Object
UserDefinedMethodsDemo obj = new UserDefinedMethodsDemo();
System.out.println(obj.add());
obj.login();
obj.sum();
// call the static method as classname.methodname
UserDefinedMethodsDemo.mul();
}
}