Author Topic: java code block  (Read 474 times)

Offline BigBear.

  • ***
  • Posts: 498
  • Registered: 21/06/2017
    YearsYearsYearsYearsYearsYears
java code block
« on: 30 10, 2022, 07:21:21 pm »
what bracket is for annoted (tagged) java code on this forum? It's like the (code) bracket but with enumerated lines

Offline BigBear.

  • ***
  • Posts: 498
  • Registered: 21/06/2017
    YearsYearsYearsYearsYearsYears
Re: java code block
« Reply #1 on: 30 10, 2022, 07:30:05 pm »

Offline IDriver

  • Senior Community Member
  • ****
  • Posts: 1409
  • ███████████] 99%
  • Registered: 23/07/2012
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
  • Ingame: IDriver#BOSS
Re: java code block
« Reply #2 on: 04 11, 2022, 09:20:16 am »
Here is a notation rule used in Java code: a bracket should either start/end a line or be paired on the same line.

The notation applies universally to any programming language (incl. Java, Ruby, Python, C++, PHP, etc.) where brackets are used for method/function calls.

Here is how your code will look, if you follow this “Paired Brackets” notation:

new Foo( // ends the line
  Math.max(10, 40), // open/close at the same line
  String.format(
    "hello, %s",
    new Name(
      Arrays.asList(
        "Jeff",
        "Lebowski"
      )
    )
  ) // starts the line
);
Obviously, the line with a closing bracket should start at the same indentation level as the line with its opening pair.

My introduction | My YouTube | Facebook | Discord idriverr
TOP50-IDriver $1 | 7,2k Hours IG | SCM | DL3 IG | Crim Level 40 | Ex-Minister of Housing

Offline M3dusa

  • degen
  • L4 Staff
  • ****
  • Posts: 3966
  • Gambling connaisseur 🔻
  • Registered: 24/11/2013
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
  • Ingame: [CIT]Medusa
Re: java code block
« Reply #3 on: 12 11, 2022, 01:58:54 pm »
@BigBear. is this resolved?
Former Former CIT Staff
Head Staff
Retired Police Chief

Seasoned trader? Click me.
Sick of being a 9-5 wageslave? DCA into $AVAX and enjoy an early retirement!
NOT FINANCIAL ADVICE, DO YOUR OWN RESEARCH