+ 3

Where should we use case sensitive in Java

I am noob help me

27th Aug 2019, 6:31 PM
Maheedhar Vegesana
Maheedhar Vegesana - avatar
5 Respuestas
+ 10
for creating veriables or method
27th Aug 2019, 6:36 PM
Sumit Programmer😎😎
Sumit Programmer😎😎 - avatar
+ 2
The class: public class Program{ } inside in it the so main method which you need to execute your code: public static void main(String[] args){ } methods which you call: * .nextLine() -> Scanner method * .parseInt() -> Integer method * .substring() -> String method * out.println() -> System method variables: * scanner from type Scanner * value from type String * numberOne from type int * numberTwo from type int Scanner and String are objects (instance of a class). int is a primitive data type. Class names or objects starts with capital letter. To create an object you need the keyword new: Scanner scan = new Scanner(System.in); String is a bit different because it is an object but you can use it like a primitive data type. variable names and methods starts with lower case letters and each next word with capital letters: numberOne instead of numberone And methods have always brackets at the end of the name: Integer.parseInt() or value.substring() myMethod() myVariable
27th Aug 2019, 10:10 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
Maheedhar Vegesana Because String is a class in java and in java first letter of class name must be capital. String str = new String("hello world"); Also we can write: String str = "hello world"; And I think it is for java.lang.String If it is wrong plz correct it!
27th Aug 2019, 8:13 PM
Amir01
Amir01 - avatar
0
public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String value = scanner.nextLine(); int numberOne = (Integer.parseInt(value.substring(0, 1)) + (Integer.parseInt(value.substring(1, 2)))); int numberTwo = (Integer.parseInt(value.substring(2, 3)) + (Integer.parseInt(value.substring(3, 4)))); System.out.println("Result: " + numberOne + numberTwo); } } what are variables and methods in this code
27th Aug 2019, 6:49 PM
Maheedhar Vegesana
Maheedhar Vegesana - avatar
0
and why String starts with ^S
27th Aug 2019, 6:50 PM
Maheedhar Vegesana
Maheedhar Vegesana - avatar