0

What is wrong in this code? Could anyone correct this, pls?

public class program { public static void main (String []args) { String Name; name=Bc; int age; age=17; double height; height =170.75; System .out .println ("name+"age+"height "); }}

27th Jul 2016, 5:37 AM
BARATH CHELLIAH
BARATH CHELLIAH - avatar
18 Réponses
+ 7
public class Program{ public static void main(String[] args){ String name = "Bc"; int age = 17; double height = 170.75; System.out.println("Name:" + name + " Age:" + age + " Height:" + height); } } There, made it all nice for you :)
27th Jul 2016, 6:17 AM
James
James - avatar
+ 2
you have bad declare and sysntax error try this edited your code : public class program { public static void main (String []args) { String name; name="bc"; int age; age=17; double height; height =170.75; System .out .println (name+age+height); } }
27th Jul 2016, 12:09 PM
Mohammad Reza Karimi
Mohammad Reza Karimi - avatar
+ 1
thank u bro .....u ANY other mistakes ...
27th Jul 2016, 5:39 AM
BARATH CHELLIAH
BARATH CHELLIAH - avatar
+ 1
k bro
27th Jul 2016, 5:41 AM
BARATH CHELLIAH
BARATH CHELLIAH - avatar
0
name = "BC"; Strings have to have quotations. Also, println has unnecessary quotations. Do (name + " " + age + " " + height);
27th Jul 2016, 5:38 AM
James
James - avatar
0
I edited my post, missed the println ones at first
27th Jul 2016, 5:40 AM
James
James - avatar
0
You've declared the string variable as Name and used as name.. it is case sensitive
27th Jul 2016, 5:44 AM
Yathindra S
Yathindra S - avatar
0
missed that lol. debugging while working. Multitask fail
27th Jul 2016, 5:49 AM
James
James - avatar
0
Hi! james i couldn't understand what you are saying? can you please explain...
27th Jul 2016, 5:53 AM
Yathindra S
Yathindra S - avatar
0
Was saying I was trying to debug his code while I'm at work so I missed the String Name error you caught.
27th Jul 2016, 5:57 AM
James
James - avatar
0
thank u all ......
27th Jul 2016, 9:14 AM
BARATH CHELLIAH
BARATH CHELLIAH - avatar
0
Name = Bc
27th Jul 2016, 10:31 AM
Denis Imamovic
Denis Imamovic - avatar
0
Bro check the string & name
27th Jul 2016, 1:27 PM
fayaz
fayaz - avatar
0
Hello! First problem: Class should always start with capital (ex. Program instead of program). Second: You created variable "Name" with a capital "N", but you declared as "name" with small "n" under it. In programming variable names ALWAYS must be the same after declaring them. Third: When you declare a String variable always use "". Try coding name = "Bc"; instead. Fourth: System.out.println("name+""age+""height ) So, when you print a variable value never put them in double quotes (these: ""). Do like System.out.println( name + age + height); Don't put + into double quotes either, since they have to connect the output together. Like firstName + lastName. Good luck w/ coding! :)
27th Jul 2016, 8:17 PM
Zsombor Simon
0
there's those " in the start and end of the line
2nd Aug 2016, 4:52 PM
namiraty omar
namiraty omar - avatar
0
"name+age+height"
2nd Aug 2016, 4:53 PM
namiraty omar
namiraty omar - avatar
0
Java is a case sensitive language and so Pls check the cases of your variable names. Also, In order to print the values that are stored within variables, you need not use double quotes in the bracket of the SOP statement
17th Nov 2016, 4:51 PM
Prarabdh Garg
Prarabdh Garg - avatar
- 1
There are many mistakes bro .. Class name should start with capital letter and String Name is used as name find out similar errors....
27th Jul 2016, 6:11 AM
Prashant
Prashant - avatar