🔒 Closed Tanong po about sa programming

Status
Not open for further replies.

Nero Swallowtail

Honorary Poster
guys para san po ba yung
JavaScript:
String word = new String();// ewan ko kung ilalagay din ung variable after nung data type , di ko kase kinakabisado yung syntax nya kase di ko maisip yung san magagamit hehe
bat di na lang i direct na i declare ung laman nung string? para san ba nagagamit ung ganyang declaration?
 
Ganyan po dapat gawin if nka paloob sya sa Action Button ng code mo.

If not declared public pede tung code ko. if nsa loob sya ng action

Public declare
String word = "Lol";


inside button- will generate new string word new value.
String word = New string;
Pede po to pag gusto mo overwrite yung values.
word = "New String"
 
[XX='Nero Swallowtail, c: 1081148, m: 1752019'][/XX] hmmm, well possible reason kung bakit naka instantiate sa no args String constructor yung variable, dahil siguro sa coding standard. Sa industry kasi, pwedeng iflag(need to refactor) yung pag iinitialize ng string literal ng mga plugins sa project app like checkstyle, solarlint etc. or mismong co developer mo pag cinode review, lalo na't empty string. It's better to initialize it in that way kung empty string lang din naman ang default value. best practices lang kumbaga.
 
Status
Not open for further replies.

Similar threads

About this Thread

  • 7
    Replies
  • 458
    Views
  • 4
    Participants
Last reply from:
Arjienx

Trending Topics

Online now

Members online
1,183
Guests online
4,005
Total visitors
5,188

Forum statistics

Threads
2,309,390
Posts
29,190,672
Members
1,190,538
Latest member
bellyjo
Back
Top