private String girlName;

0 Aviansh Allam · October 26, 2015
what is the use of writing the line
  private string girlname;

Post a Reply

Replies

Oldest  Newest  Rating
+1 Gary Whitney · October 27, 2015
You are going to have a lot of these questions if you don't learn java.
Start with the java tutorials.

Here is my answer to your question.
private defines the scope i.e. only this code container can access it.
String is a text object. it contains a string of characters.
girlName is just  a variable or more precisely a reference to a place in memory where the string of  characters is stored.
0 Developer John · October 29, 2015
girlname is also the name of your variable. When you create a variable or even initialize it, the Java compiler creates a space in memory for that variable to be used. Another thing to point out is that you typed out "string" instead of String. In Java, capitalizing letters really does matter, so the compiler knows what you're referring to. I believe the only places where capitalization does not matter is either in a String or a char, that is, if you're not comparing a String or a char to another variable, method invocation, or variable invocation.  
0 Ethan Z · October 30, 2015
You would be wrong there, John. It does still matter.

String vs string
  (OK)       (Compiler error)

char vs Char
 (OK)    (Compiler error)

Character vs character
   (OK)             (Compiler error)
0 Developer John · October 30, 2015
Ethan, that's not what I said. I directly stated "in a String or a char", which means:


String s = "the state of washington, which is totally not capitalized(nor the t in The).";
Char c = 'c';
Char C = 'C';
//SEE, INSIDE BOTH OF THESE DATA TYPES, CAPITALIZATION DOES NOT MATTER!
  • 1

Java / Android Development

106,922 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator