🔒 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
  • 446
    Views
  • 4
    Participants
Last reply from:
Arjienx

Trending Topics

Online now

Members online
923
Guests online
1,098
Total visitors
2,021

Forum statistics

Threads
2,272,700
Posts
28,944,699
Members
1,236,377
Latest member
adoic
Back
Top